Last Updated: February 25, 2016
·
3.117K
· silvercorp

Getting the values of jQuery UI Slider

/*
Getting the values of jQuery UI Slider.
Link: http://jqueryui.com/slider/
Using this component I needed to get the range, I will explain how I did.

Obteniendo los valores de jQuery UI Slider
Usando este componente tuve la necesidad de obtener los rangos, explico a continuación como lo hice.

*/

$( "#progressbar" ).slider({
  range: !0,
  min: 2e3,
  max: 2013,
  step: 1,
  values: [2e3, 2013],
  slide: function(a, b){
    var min = b.values[0];
    var max = b.values[1];

    console.log(min + " " + max);        
    return $(".nav .active").removeClass("active"), $(".y" + b.values[0]).addClass("active"), $(".y" + b.values[1]).addClass("active"), $("span.nav").html(b.values[0] + "-" + b.values[1])
  },
  start: function( a, b) {
    //console.log(event);
  },
  stop: function(a, b){
    //console.log(event);
  }

});

1 Response
Add your response

Y si se quiere obtener los valores fuera del slider sería de esta manera:

var start = $( "#progressbar" ).slider('option','values')[0];

var end = $( "#progressbar" ).slider('option','values')[1];

over 1 year ago ·