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

99
Visualizações
How to prevent page scroll while scrolling options in dropdown?

I have an element dropdown with a vertical or horizontal overflow and when it reach the end of the scroll, the browser will start scrolling the parent element(scroll chaining).I want to prevent this default behaviour. I have tried following ways

overscroll-behavior: contain;

It has no browser support for safari.

Also use event.preventDefault() to prevent the default behavior so it blocks scrolling the page. We can’t prevent scrolling by using event.preventDefault() in onscroll listener, because it triggers after the scroll has already happened.

document.body.addEventListener('onscroll',function(e){
  e.preventDefault();});

I need a solution which also supports safari browser.

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