Okay bear with me, I know this might have been asked a few times but I can't get the exact answer after searching a bit.
Basically what I want is as the user starts to scroll down, after a certain height the div disappears.. and it remains disappeared until the user starts to scroll up. Right when the user starts to scroll up, the div appears again. I need some sort of fade effects for this as well.
This is what I've come up with by looking at other answers so far. With this, the div does disappear after a certain height as you scroll down, but it only re-appears when you reach that same height when you scroll up. I want the div to immediately show itself when the user starts to scroll up. This code doesn't have any animations either...
jQuery(window).scroll(function() {
if (jQuery(this).scrollTop()>0)
{
jQuery('.myDIV').fadeOut();
}
else
{
jQuery('.myDIV').fadeIn();
}
});
.scrollTop()
value in an extra var. Then when scrolled, check if the new.scrollTop()
is greater than or smaller than the stored value, and do the things accordingly and store the new value.jQuery(this).scrollTop()>0
?? and when do you think your scrollTop will be less than0