The simplest JavaScript custom range slider ever!
The simplest JavaScript custom range slider ever!
The required HTML is:
<div id="range-slider-1"></div>
Execution…
// horizontal slider
RS(document.getElementById('range-slider-1'), function(value, target, event) {
console.log(value);
});
// vertical slider
RS(document.getElementById('range-slider-1'), function(value, target, event) {
console.log(value);
}, true);
RS(document.getElementById('range-slider-1'), {
value: 1, // initial value
vertical: false, // vertical or horizontal slider?
create: function(value, target) { … }, // create event
start: function(value, target, event) { … }, // start event
drag: function(value, target, event) { … }, // drag event
stop: function(value, target, event) { … } // stop event
});
<input type="range">
if JavaScript is Disabledmin
and max
Value in Range Slider as PixelUpdate 2016/07/21: Is now has support for touch devices by default.