$(window).scroll(function () {
if ($(window).scrollTop() > 100) {
$('.nav').css('margin-top', '5px');
$('.sep').css('margin-top', '20px');
$('.logo').fadeOut(500);
$('#navWrap').animate({
height: '62px'
}, 500, function() {
});
}
}
);
$(window).scroll(function () {
if ($(window).scrollTop() < 100) {
$('.nav').css('margin-top', '23px');
$('.sep').css('margin-top', '40px');
$('.logo').fadeIn(500);
}
}
);
我有这段代码,当你向下滚动时,它使我的导航动画高度从 100px 到 62px,当你再次到达顶部时,我试图让它动画回 100px,但似乎不能这样做。
我通常在第二个窗口 .scroll 函数中再次包含 .animate ,但这没有任何作用。