0

I want to set the 2nd handle in my jquery slider to a variable. so for example lets just say the variable is "x" my code looks like this

function $sliderHandle2(x) {
//set the 2nd handle here
var value = $( "#slider-range" ).slider( "1", "value" );
$( "#slider-range" ).slider( "1","value", x );
}

I did this using the API from the website but its not working so i assume its very wrong. I thought the "1" would be the number of the handle .

can anyone tell me what part ive done wrong ? I JUST want to set the second handle

4

2 回答 2

0

完全忘记了 API 指令并自己解决了,这改变了句柄的值。

$("#slider-range").slider('values',1,x);

其中 1 是句柄索引,x 是您要设置的值

于 2013-07-17T10:54:34.033 回答
0

另一个解决方案:

$("#slider-range").slider({
    animate: "fast",
    min : 0,
    max: 4,
    value: 4,
    values : [0,4], // This is it ...
........
});
于 2017-07-01T12:06:18.143 回答