I want to show a DIV after scrolling e.g. 800px down. To do that, I'm using the great snippet from here:
$(document).scroll(function() {
var y = $(this).scrollTop();
if (y > 800) {
$('.bottomMenu').fadeIn();
} else {
$('.bottomMenu').fadeOut();
}
});
That works very well. But now I want to add another step.
If I scroll to the .footer
of the site, I want to hide the DIV again until I leave the footer.
I thought I could change another snippet from the answer above:
$('.footer').each(function () {
var y = $(document).scrollTop();
var t = $(this).parent().offset().top;
if (y > t) {
$('.bottomMenu').fadeIn();
} else {
$('.bottomMenu').fadeOut();
}
});
Unfortunately I'm not able to figure it out.