How to substitute the slider value into the maximum value of another?
-
There are 2 nouislider .
It is necessary in the maximum value of 2 sliders, substitute the current value of 1 slider.
For example, if in the first slider we select 100,000, then the maximum value of the second will be 100,000.
I understand how to get the value of 1 of the slider, but there is a problem with the scope of the variable, the slider simply does not see it.JavaScript Charlotte Pierce, Sep 1, 2020 -
I wrote it down, added it to codepen.io. Necessary add. set the parameters yourself
stepsSlider.noUiSlider.on('change.one', function() {
vals = stepsSlider.noUiSlider.get();
var processed = vals.replace(/ /g, '');
res = parseFloat(processed, 10);
// Как то так https://refreshless.com/nouislider/more/#section-update
stepsSlider2.noUiSlider.updateOptions({
range: {
'min': 0,
'max': res
}
});
});
The problem was not in scope. You just haven't looked at the example from the documentation . There is a button on the right Updating the slider with new options on button click click on it and you will see examples.Anonymous
1 Answers
Your Answer
To place the code, please use CodePen or similar tool. Thanks you!