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

176
Vistas
Control the position of the slider thumb

I have this comparison Slider and on page refresh I want the position of the Dot(thumb) of the range slider to be in the middle and not take the same position as before the page refresh. position image preview

So when reloading the page the range slider is not even to the current "Compare" position

let slideValue = document.querySelectorAll('.jsSliderComparison')
slideValue.forEach((clicker) => {
  clicker.addEventListener('input', sliderComparison)
})

function sliderComparison(e) {
  slideValue.forEach((el) => {
    document.querySelectorAll('.jsSliderComparer').forEach((element) => {
      element.style.clipPath =
        'polygon(0 0,' +
        e.target.value +
        '% 0,' +
        e.target.value +
        '% 100%, 0 100%)'
    })
  })
}
<div class="slider slider--comparison">
  <img src="SOURCE" />
  <img class="jsSliderComparer" src="SOURCE" />
  <input max="100" min="0" value="50" type="range" class="jsSliderComparison" />
</div>

Solution: Set a default on load

slideValue.forEach((loader) => {
  loader.value = 50
})
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