Jquery: détection de la position de défilement

Je souhaite recevoir une alerte lorsque, lors du défilement, mon pied de page vient voir.

$(window).on("mousewheel", function(){ if ($(window).scrollTop() + $(window).height() > $('#footer').position().top){ alert("footer visible"); } else{ alert("footer invisible"); } }); 

Http://jsfiddle.net/JRUnr/10/

Toutes les conditions avec hauteur semblent correct, mais pas pendant le défilement. Si quelqu'un peut m'aider, il serait vraiment apprécié.

Working DEMO

Essaye ça

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

J'espère que cela vous aide, merci

Il existe un plugin jquery pour cette tâche nommé jQuery Waypoints ( http://imakewebthings.com/jquery-waypoints/ )

 $('#footer').waypoint(function(direction) { alert('Top of thing hit top of viewport.'); }); 

Voici une violon de travail … http://jsfiddle.net/kasperfish/JRUnr/14/

Il est piraté, mais ça marche

  flag=true; $(window).scroll(function() { st=$(window).scrollTop(); $('#topscroll').html(st) if(st>1450){ if(flag) alert('test');flag=false; } });