I want to show a sticky menu nav when scrolling up while also having a delay before showing the nav menu. I can do this with animate and opacity, but it's not as effective.
I tried to show the nav menu when scrolling up 50px from the current position, but it didn't work.
Here's the script:
var previousScroll = 0,
headerOrgOffset = $('#header').height();
$('#header-wrap').height($('#header').height());
$(window).scroll(function () {
var currentScroll = $(this).scrollTop();
if (currentScroll > headerOrgOffset) {
if (currentScroll > previousScroll) {
$('#header-wrap').slideUp();
} else {
$('#header-wrap').slideDown();
}
}
previousScroll = currentScroll;
});
FIDDLE DEMO
Note: I saw this feature in the script for Headroom.js
How can I do this?