【发布时间】:2013-08-27 05:08:20
【问题描述】:
我正在尝试使网站标题变得粘性,使徽标 img 更小,并在用户向下滚动页面 100 像素时重新定位导航链接。
这是我目前拥有的:
$(document).ready(function() {
$(window).scroll(function() {
if ($(document).scrollTop() > 100) {
$('#header').addClass('sticky');
$('#logo img').animate({'width':'200px','top':'-10px'});
$('#header').animate({'height':'70px'});
$('#menu_btns ul li').animate({'top':'-24px','left':'-90px'});
$('#store_links').animate({'top':'-20px','left':'0px'});
}
else {
$('#header').removeClass('sticky');
$('#logo img').animate({'width':'287px','top':'0px'});
$('#header').animate({'height':'116px'});
$('#menu_btns ul li').animate({'top':'0px','left':'0px'});
$('#store_links').animate({'top':'0px','left':'0px'});
}
});
});
我遇到的问题是在向下滚动并且所有动画后,在返回后没有“其他”动画执行。
【问题讨论】:
-
你试过使用航点吗?
-
@otherDewi 是否可以使用航点运行多个动画?使用我当前的代码,我可以让粘性导航起作用,但只要我添加动画,一切都会中断。
-
查看我的更新答案
标签: jquery header navigation jquery-animate fixed