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

217
Vistas
How can user trigger links (Slide the ball and mouse up to open that range link) without clicking the button 'Take me to my ideal object!'?

How can user trigger links without clicking the button 'Take me to my ideal object!' or how can user open a link on slider value change or on mouseup ? Basically user Slide the ball and mouse up to open that range link.

// Setting custom points to slider
var values = [0, 1000,2000,4000,10000];

var input = document.getElementById('tierslider'),
    output = document.getElementById('tierslider2');
    
input.oninput = function(){
    output.innerHTML = values[this.value];
};

input.oninput();

// Redirect 
function redirectToLinks(elem){
  window.location.href = elem.dataset.baselink + values[input.value];
}
<div id='slidecontainer'>
      <form>
          <span>500</span>
          <input type='range' min='0' max='4' value="0" step="1" id='tierslider'>
          <span>10000</span>
          <span id='tierslider2'></span>
      </form>
</div>

<a href='#' data-baselink='http://www.example.com/page?param=' id='DisplaySliderResult' onclick="redirectToLinks(this)">Take me to my ideal object!</a>

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Range sliders are kind of weird, but you're on the right track - why not change your 'oninput' function and use [addEventListener] to listen to a change event (instead of an input event)?

In the same way you've updated the value of the tierslider2 span, you can call you redirect function when this event fires. Event handlers are just that - you get to run your own custom event handling code in them.

// Setting custom points to slider
var values = [0, 1000,2000,4000,10000];

var input = document.getElementById('tierslider'),
    output = document.getElementById('tierslider2'),
    myLink = document.getElementById('DisplaySliderResult');
    


// Redirect 
function redirectToLinks(elem){
  window.location.href = elem.dataset.baselink + values[input.value];
}

input.addEventListener('change', function() {
    // you've already 'handled' this event - now just do what you want! in your case, redirect the user to some other place without them clicking the link
    output.innerHTML = values[this.value];
    redirectToLinks(myLink);
});
<div id='slidecontainer'>
      <form>
          <span>500</span>
          <input type='range' min='0' max='4' value="0" step="1" id='tierslider'>
          <span>10000</span>
          <span id='tierslider2'></span>
      </form>
</div>

<a href='#' data-baselink='http://www.example.com/page?param=' id='DisplaySliderResult' onclick="redirectToLinks(this)">Click to take me to my ideal object!</a>

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