Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

174
Vistas
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 la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda