I currently have the following code which delays showing a fixed bar after a certain point.
The code hides the fixed bar if you scroll up to the top, but automatically shows the bar after 2 seconds, even though the scroll point is below 70, so it should be hidden all together.
$(window).scroll(function() {
if($(window).scrollTop() > 70) {
$('#mini-header').delay(2000).show(0);
} else if($(window).scrollTop() < 70) {
$('#mini-header').hide();
}
});
A jsFiddle shows the behaivor.
You can change your
else ifto a simpleelseand hide the div bydisplay: none–FIDDLE DEMO
UPDATED DEMO
The
animate()acts like adelay()but the difference – you canstop()it.