Friday, May 17, 2024
 Popular · Latest · Hot · Upcoming
61
rated 0 times [  64] [ 3]  / answers: 1 / hits: 49024  / 11 Years ago, sat, september 21, 2013, 12:00:00

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);
}
});


http://jsfiddle.net/JRUnr/10/



All conditions with height seem right, but not during scrolling.


More From » jquery

 Answers
6

Working DEMO



Try this



$(window).scroll(function () {

if ($(window).scrollTop() + $(window).height() > $('.footer').offset().top) {
alert(footer visible);
} else {
alert(footer invisible);
}
});


Hope this helps,Thank you


[#75547] Friday, September 20, 2013, 11 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
jesse

Total Points: 513
Total Questions: 118
Total Answers: 106

Location: Denmark
Member since Tue, Jul 19, 2022
2 Years ago
;