I want to get an alert when, while scrolling, my footer comes to view.
$(window).on("mousewheel", function(){
if ($(window).scrollTop() + $(window).height() > $('#footer').position().top){
alert("footer visible");
}
else{
alert("footer invisible");
}
});
All conditions with height seem right, but not during scrolling.
offset()
to get the position w.r.t. document top - as in the fiddle above.