Jquery fadeOut does not stay hidden

21 Views Asked by At

I want to fade out a div on scroll with jquery. When it fades out it directly fades back in. It only has to fade back in when its less than 20. Otherwise stay hidden.

Any ideas what i'm doing wrong?

$( window ).on("load", function() {
  $(window).scroll(function() {
  if ($(this).scrollTop()>20)
  {
   $("#intro").fadeOut();
  }
  else
{
 $('#intro').fadeIn();
};
});
});
0

There are 0 best solutions below