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

179
Visualizações
HTML5/JS Slider Range Bar: Only allow click events, no touchdown/mousedown

I have a problem with the slider bar from HTML5 using bootstrap css/js.

Especially the mobile view has a lot of control elements, so it requires scrolling up/down. This also works quite well. Unfortunately the slider bar triggers when scrolling so the slider changes value.

With buttons etc. this is easy with scrolling, if not clicked a button usually does not trigger.

Can this behavior also be implemented for slider bars? Otherwise, with each scroll operation with the finger, the slider accidentally assumes a new value.

This is the code for the Slider bar:

<label for="customRange-1" class="form-label">[LABEL]</label>
<input type="range" class="form-range" min="0" max="10" id="customrange-1">

To catch changes I use this JavaScript:

$('input[type=range]').on('input', function () { 
// some actions
)};

I tried to disable touchdown events:

$('input[type=range]').on('touchdown', function (e) {
    e.preventDefault();
});

But the problem is that the value can't be changed anymore. I only want to allow 'click' similar 'touch' events, but no touchdown-hold events used for scrolling a page.

Has anyone an idea?

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