function menuOnScroll() {
var st = getCurrentScroll();
if(Math.abs(lastScrollTop - st) <= delta)
return;
if (st > lastScrollTop && st > navbarHeight)
{
$header.removeClass('nav-visible').addClass('nav-hidden');
}
else
{
if(st + $window.height() < $document.height())
{
$header.removeClass('nav-hidden').addClass('nav-visible');
}
}
lastScrollTop = st;
}
$window.scroll(function(event){
if (!$body.hasClass('search-open'))
didScroll = true;
});
setInterval(function() {
if (didScroll) {
menuOnScroll();
didScroll = false;
}
}, 250);
Hide menu on scroll down; show menu on scroll up
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.