jquery - Hide a div when page is still, show on scroll movement up -
i want sticky header on chrome (?) on android.
ie, scroll down page, there no sticky header, scroll up, (or after 1 second) sticky header appears again.
then, when scroll down hides once more.
i think far better sticky header solution can find tutorials refer waypoints, , want based on movement, not fixed positions.
can give me bare bones example of this?
would great, thanks.
check working fiddle .i hope need..
var scroll_pos = 50; var scroll_time; if($('.gridcontainer').is(':visible')) $('.gridcontainer').addclass('hidden'); $(window).scroll(function() { cleartimeout(scroll_time); var current_scroll = $(window).scrolltop(); if (current_scroll >= $('#topnav').outerheight()) { if (current_scroll <= scroll_pos + 100) { $('.gridcontainer').removeclass('hidden'); } else { $('.gridcontainer').addclass('hidden'); } } scroll_time = settimeout(function() { scroll_pos = $(window).scrolltop(); }, 600);
});
Comments
Post a Comment