0

How can I hide my sticky header after 100px on scroll down and show it again after 1px on scroll up?

I'm at this point:

$(window).scroll(function() {
var height = $(window).scrollTop();
if ($(window).scrollTop() > 100) {
$("#header").fadeOut(300);  } else {
$("#header").fadeIn(300);    } });

It works, but I would like to show the header again on scroll up immediately, not at 100 px from the top.

mkrieger1
  • 19,194
  • 5
  • 54
  • 65
  • if I got your point .. I think you will need http://stackoverflow.com/questions/4326845/how-can-i-determine-the-direction-of-a-jquery-scroll-event – Mohamed-Yousef Feb 08 '17 at 00:24
  • Thank you for the link but is not exactely what I'm lookig for... Every script works with the same idea, if set 100px, for example, it show/hide the element at the same point in both direction (scroll up / down) while I need to hide my menu after 100 px and show it again if I scroll up at any point of the document. – user1818326 Feb 08 '17 at 08:05

0 Answers0