$("#something").slider({
range: true,
values: [25, 75],
min: 0,
max: 100
});
$("#something").slider("option", "min", 25); // left handle should be at the left end, but it doesn't move
$("#something").slider("option", "values", [25, 75]); // the left handle is now at the left end, but doing this triggers events
编辑此问题已在 jQuery UI 1.9 中修复
$(function() {
var $slide = $("#something").slider({
range: true,
values: [25, 75],
min: 0,
max: 100
});
$slide.slider("option", "min", 25); // left handle should be at the left end, but it doesn't move
$slide.slider("value", $slide.slider("value")); //force the view refresh, re-setting the current value
});
function resetSlider(){
$("#slider-fill").attr('value',maxPrice);
$("input[type='range']").slider( "refresh" );//refresh slider to max value
$(".ui-slider-handle").css("left","100%");
console.log("Slider Reset Done.");
}
valPercent = (current_slide_value - min_value) / (max_value - min_value) * 100;
parentElem.find('.ui-slider-range').css('width', valPercent+'%');
parentElem.find('.ui-slider-handle').css('left', valPercent+'%');
$("#mySlider").slider({range: true, min: 0, max: 100, values: [ 0, 100 ], step: 10,
slide: function( event, ui ) {
$("#mySliderMin").val( ui.values[ 0 ]);
$("#mySliderMax").val( ui.values[ 1 ]);
}
});
$("#mySliderMin").val($("#mySlider").slider( "values", 0 ));
$("#mySliderMax").val($("#mySlider").slider( "values", 1 ));
$("#mySliderMin, #mySliderMax").change(function () {
$("#mySlider").slider("values", 0, $("#mySliderMin").val());
$("#mySlider").slider("values", 1, $("#mySliderMax").val());
});
var d='<div class="row grid_slider"><div><p>Grid With time in 24 hour format</p><input type="text" class="range_time24" value="" name="range" /></div></div>';document.getElementById("slider").innerHTML=d;
然后为滑块设置新值
$("#Slider2").slider("value", 10, 1000); //10 = min and 1000 = max
$('.slider').slider('destroy')
然后使用正确的选项再次设置滑块。
$( ".price-range-slider" ).slider({
range: true,
min: 1,
max: 500,
values: [ 10, 50 ],
slide: function( event, ui ) {
$( "input.property-amount" ).val( "₹" + ui.values[ 0 ] + " Lac - ₹" + ui.values[ 1 ] + " Lac" );
console.log($("input.property-amount").val());
},
change: function( event, ui ) {
console.log(ui.values);
console.log('fn called');
}
});