开发者

Jquery UI slider, setting values bug

i have 3 div's

<div id="slider-range1" class="slider-range"></div>
<div id="slider-range2" class="slider-range"></div>
<div id="slider-range3" class="slider-range"></div>

i have added the slider to these div's using class reference

$(function() {
        $(".slider-range").slider({
            range: true,
            min: 0,
            max: 100,
            slide: function(event, ui) {

            }
        });
});

the ranges of each sliders are different. I want to add that dynamically

I tried开发者_运维百科

$("#slider-range1").slider('option','values',[1, 100]);

but it is not working :(


have you tried:

$('selector').slider( 'values' , index , value ); // index would be the square in the slider

in your example you could:

$("#slider-range1").slider('values', 0, 50);
$("#slider-range1").slider('values', 1, 100);


$('#slider-range').slider('option', 'min', 1);

$('#slider-range').slider('option', 'max', 100);

Updated according to poster's comment on this answer:

Actually, your question contains an naswer :)

http://jqueryui.com/demos/slider/#option-range

$("#slider-range").slider({
    range: true,
    min: 0,
    max: 500,
    values: [75, 300],
});
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜