File size: 722 Bytes
fcf8580
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23

var rangeInputs = null;
var numberInputs = null;


function setSlider() {
    function setSliderRange() {
        var range = document.querySelectorAll('input[type="range"]');
        range.forEach(range => {
            range.style.backgroundSize = (range.value - range.min) / (range.max - range.min) * 100 + '% 100%';
        });
    }
    rangeInputs = document.querySelectorAll('input[type="range"]');
    numberInputs = document.querySelectorAll('input[type="number"]')
    setSliderRange();
    rangeInputs.forEach(rangeInput => {
        rangeInput.addEventListener('input', setSliderRange);
    });
    numberInputs.forEach(numberInput => {
        numberInput.addEventListener('input', setSliderRange);
    })
}