Hide header on scroll down, show again on scroll up - goes to Dynamik Custom - JS (or skin JS) Credits: https://medium.com/@mariusc23/hide-header-on-scroll-down-show-on-scroll-up-67bbaae9a78c#.uv231ifg1, bloxwp.com
jQuery(function( $ ){
// Hide Header on on scroll down
var didScroll;
var lastScrollTop = 0;
var delta = 5;
var navbarHeight = $('.site-header').outerHeight();
$(window).scroll(function(event){
didScroll = true;
});
setInterval(function() {
if (didScroll) {
hasScrolled();
didScroll = false;
}
}, 250);
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 > navbarHeight){
// Scroll Down
$('.site-header').removeClass('nav-down').addClass('nav-up');
// Hide navbar on scroll up if the mobile navbar is active, comment if not needed
if ( $(window).width() < 1024 ) {
$('header .genesis-nav-menu').hide();
}
} else {
// Scroll Up
if(st + $(window).height() < $(document).height()) {
$('.site-header').removeClass('nav-up').addClass('nav-down');
}
}
lastScrollTop = st;
}
});
.site-header {
position: fixed;
top: 0;
transition: top 0.4s ease-in-out 0s;
width: 100%;
z-index:9999;
}
.site-header.nav-up {
top: -80px; /*Adjust to your header height*/
}
body {padding-top:80px;} /*Adjust to your needs, copy for media queries*/