I'm trying to test if a <div>
has been scrolled out of view.
This is what I have so far,
$(window).on('scroll',function(){
var divBottom = $('#home').offset().bottom;
var windowTop = $(window).scrollTop();
var windowBottom = windowTop + $(window).height();
if (divBottom >= windowTop) {
console.log("yes");
} else {
console.log("no");
}
});
No matter where I scroll, nothing is logged.
What I was trying to test is if the bottom of the div has gone past the top of the window.