Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

162
Visualizações
How to tell if element is currently actively scrolling

I'd like to stop certain things from happening while an element is being scrolled. Scrolling may start when the mouse wheel / mouse pad is used, but it may also happen from a scrollIntoView() being called. Is there a way to tell if an element is currently being scrolled directly from that element?

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Here is a function that helps you to detect scrolling with debounce and you can start to invoke any function after a set timer.

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda