jQ171(document).ready(function ($) {
/* ==========================================================================
Hide Header OnScroll
========================================================================== */
var didScroll;
var lastScrollTop = 0;
var delta = 5;
var headerHeight = $('.scroll-header').outerHeight();
$(window).scroll(function (event) {
didScroll = true;
});
setInterval(function () {
if (didScroll) {
hasScrolled();
didScroll = false;
}
}, 120);
function hasScrolled() {
var st = $(this).scrollTop();
// Make sure they scroll more than delta
if (Math.abs(lastScrollTop - st) <= delta)
return;
// If they scrolled down and are past the navbar, add class .nav-up.
// This is necessary so you never see what is "behind" the navbar.
if (st > lastScrollTop && st > 120) {
// Scroll Down
$('.scroll-header').removeClass('header-show').addClass('header-hide');
// when user gets to ~XXX pixels from the top of page, remove classes
} else if (window.scrollY <= 120) {
$("header").removeClass("header-show");
$("header").removeClass("header-hide");
} else {
// Scroll Up
if (st + $(window).height() < $(document).height()) {
$('.scroll-header').removeClass('header-hide').addClass('header-show');
}
}
lastScrollTop = st;
}
});