如何通过更改滑块从 ion.rangeSlider 组件中获取值?
这是我的 jQuery 代码:
function rangeSlider() {
var $range = $(".js-range-slider");
$range.ionRangeSlider({
type: "single",
min: 0,
max: 5,
// from: 0,
grid: true,
}); }
如何通过更改滑块从 ion.rangeSlider 组件中获取值?
这是我的 jQuery 代码:
function rangeSlider() {
var $range = $(".js-range-slider");
$range.ionRangeSlider({
type: "single",
min: 0,
max: 5,
// from: 0,
grid: true,
}); }
您应该使用内置回调来做到这一点(onChange, onStart, onFinish
):http: //jsfiddle.net/IonDen/gefkwqv6/
var $range = $(".js-range-slider"),
$inputFrom = $(".js-input-from"),
$inputTo = $(".js-input-to"),
instance,
min = 0,
max = 1000;
$range.ionRangeSlider({
type: "double",
min: min,
max: max,
from: 100,
to: 900,
onStart: updateInputs,
onChange: updateInputs,
onFinish: updateInputs
});
function updateInputs (data) {
$inputFrom.prop("value", data.from);
$inputTo.prop("value", data.to);
}
instance = $range.data("ionRangeSlider");