¿Hay alguna manera de que pueda activar un evento con jQuery cuando la página se desplaza lo suficiente como para que aparezca un div?
Si solo necesita disparar una vez:
$(window).scroll(function(){ // This is then function used to detect if the element is scrolled into view function elementScrolled(elem) { var docViewTop = $(window).scrollTop(); var docViewBottom = docViewTop + $(window).height(); var elemTop = $(elem).offset().top; return ((elemTop <= docViewBottom) && (elemTop >= docViewTop)); } // This is where we use the function to detect if ".box2" is scrolled into view, and when it is add the class ".animated" to the <p> child element if(elementScrolled('. box2')) { // Your function here } });Respuesta completa: https://www.thewebtaylor.com/articles/how-to-detect-if-an-element-is-scrolled-into-view-using-jquery
Creo que tendrá que conectarse al evento de desplazamiento y verificar manualmente. Aquí hay una pregunta similar:
Compruebe si el elemento está visible después de desplazarse
Espero que ayude.
Beto
El plugin de waypoints cubre esto y más. http://imakewebthings.com/jquery-waypoints/
Documentos: http://imakewebthings.com/jquery-waypoints/#docs
p.ej:
$('.someSelector').waypoint(function(direction){ //do stuff },{ //bottom-in-view will ensure event is thrown when the element's bottom crosses //bottom of viewport. offset: 'bottom-in-view' });