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

165
Visualizações
how to turn off mousewheel in jquery

I want to disable the mouse wheel in jQuery and I did it but I'm getting this error

jquery.min.js:2 [Intervention] Unable to preventDefault inside passive event listener due to target being treated as passive. See https://www.chromestatus.com/features/6662647093133312

This is the code in JS file:

$(document).ready(() => {
  $(window).bind("mousewheel", function() {
    return false;
  });
})
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

The issue is because you cannot call preventDefault() on passive events, such as mousewheel is - among others.

To fix the issue you can set passive: false when you bind the event handler:

window.addEventListener('wheel', e => e.preventDefault(), {
  passive: false
});
/* just to make the scrollbar appear in this demo */
body { height: 5000px; }

However, I would strongly suggest you do not do this. Preventing users from navigating your site using the very popular mouse scroll wheel will be incredibly annoying for you users - and possibly make them believe your site is malfunctioning.

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