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

161
Views
Cómo saber si el elemento se está desplazando activamente actualmente

Me gustaría evitar que sucedan ciertas cosas mientras se desplaza un elemento. El desplazamiento puede comenzar cuando se usa la mouse wheel o la mouse pad , pero también puede ocurrir cuando se llama a scrollIntoView() . ¿Hay alguna manera de saber si un elemento se está desplazando actualmente directamente desde ese elemento?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Aquí hay una función que lo ayuda a detectar el desplazamiento con rebote y puede comenzar a invocar cualquier función después de un temporizador establecido.

 let timeOut; function debounce(delay) { console.log("It's rolling!"); clearTimeout(timeOut); timeOut= setTimeout(function(){ console.log("It's stopped!"); }, delay); } document.querySelector("#scrollable").addEventListener('scroll',(function() { debounce(200); }));
 div { border: 1px solid black; width: 200px; height: 100px; overflow: scroll; }
 <div id="scrollable">In my younger and more vulnerable years my father gave me some advice that I've been turning over in my mind ever since. <br><br> 'Whenever you feel like criticizing anyone,' he told me, just remember that all the people in this world haven't had the advantages that you've had.'</div>

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