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

211
Views
JavaScript: Desplazamiento infinito cerca de la parte inferior en div (70% cerca de la parte inferior)

Quiero implementar un desplazamiento infinito dentro de un div mediante el cual se obtienen datos cuando un usuario se desplaza más allá del 70% del contenido.

Aquí está mi código actual:

 element.onscroll = () => { let dom = document.getElementById('scrollable'); let scrollY = dom.scrollHeight - dom.scrollTop; let height = dom.offsetHeight; let offset = height - scrollY; if (offset == 0 || offset == 1) { getMoreData() } };

¿Hay alguna manera de verificar si el desplazamiento supera el 70%? ¿Sin ejecutar getMoreData() varias veces?

Necesito asegurarme de que la función getMoreData se ejecute solo una vez al desplazarme hacia abajo.

Las implementaciones en Vue también son bienvenidas.

about 4 years ago · Juan Pablo Isaza
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!