gpt4 book ai didi

javascript - 如何将开始和结束位置应用于 jquery 视差动画

转载 作者:行者123 更新时间:2023-11-28 11:52:42 25 4
gpt4 key购买 nike

这是我目前拥有的。

不过我需要添加一层细节。我想要的是从 0-1000px 不增加不透明度,然后从 1000-1500 不透明度从 0 淡化到 1。

我该怎么做?

使用这个:(woking jsFiddle)

function EasyPeasyParallax() {
scrollPos = $(document).scrollTop();
$('#nav').css({
'opacity': 0+(Math.min(scrollPos/800,1))
});
};

$(function(){
$('body').bind('mousewheel',EasyPeasyParallax);
});

最佳答案

您可以在 HTML5 浏览器支持中使用 css3 执行此操作:

@-webkit-keyframe{ /* for chrome browser */
0%{
}
50%{
}
100%{
}
}
@keyframe{ /*do the same for other browser */
0%{
}
50%{
}
100%{
}
}

关于javascript - 如何将开始和结束位置应用于 jquery 视差动画,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20237558/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com