我正在尝试将我的第一个滑块的最大限制与我的第二个滑块的最小限制联系起来。我有点卡住了。我对JS有点新手。有什么想法吗?
var slider_1 = document.getElementById('slider_1');
var priceMin = document.getElementById('priceMin');
var slider_2 = document.getElementById('slider_2');
var priceMax = document.getElementById('priceMax');
noUiSlider.create(slider_1, {
start: 0,
step: 100000,
behaviour: 'drag',
connect: [true, false],
range: {
'min': 0,
'max': 15000000
},
});
noUiSlider.create(slider_2, {
start: 15000000,
step: 100000,
behaviour: 'drag',
connect: [true, false],
range: {
'min': 0,
'max': 15000000
},
});
slider_1.noUiSlider.on('update', function (values, handle) {
priceMin.innerHTML = formatNumber(Math.round(values[handle]));
});
slider_2.noUiSlider.on('update', function (values, handle) {
priceMax.innerHTML = formatNumber(Math.round(values[handle]));
});