Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

292
Views
jQuery: ¿Cómo puedo activar un evento cuando aparece un div?

¿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?

over 4 years ago · Santiago Trujillo
3 answers
Answer question

0

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

over 4 years ago · Santiago Trujillo Report

0

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

over 4 years ago · Santiago Trujillo Report

0

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' });
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!