gpt4 book ai didi

javascript - 内容坚持横幅 onScroll

转载 作者:行者123 更新时间:2023-11-28 07:51:16 26 4
gpt4 key购买 nike

我有一个在滚动时收缩的横幅和它下面的一些内容,我怎样才能让内容在移动前在横幅上停留几秒钟?我尝试使用 jQuery 插件 stickem,但它似乎不起作用。

JS:

$(document).scroll(function(){
if ($(this).scrollTop()>175){
// animate fixed div to small size:
$('.wrapper').stop().animate({ height: 57 , 'padding-top': 50},100);
$('.text').stop().animate({ 'bottom': 50},100);
} else {
// animate fixed div to original size
$('.wrapper').stop().animate({ height: 300, 'padding-top': 0},100);
$('.text').stop().animate({ 'bottom': 150},100);
}
});

http://jsfiddle.net/bnsUB/259/

最佳答案

我通常不建议使用插件,但 Waypoints 非常适合此类应用。

http://imakewebthings.com/waypoints/

关于javascript - 内容坚持横幅 onScroll,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30405961/

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