这是我的代码,目前它连续左右滑动导航栏,当我滚动时,我需要它向左滑动一次,因为我向下滚动。然后,当我向上滚动时,我希望它向右滑动并重新出现:
var scrollTop = $(window).scrollTop();
if (scrollTop > lastScrollTop && scrollTop > pixelsFromTheTop){ // ensure that the header doesnt disappear too early
// downscroll
$header.one("scrollDown", function () { $('navbar').animate({width: "toggle",},250)})(settings.transitionTime);
} else {
// upscroll
$header.animate({width: "toggle",},250);(settings.transitionTime);
}
lastScrollTop = scrollTop;
}
};
我用这个插件来帮助我开始:HidingNavBarPlugin任何人都可以帮我解决这个问题吗? :)