1
0
mirror of https://github.com/s00500/ESPUI.git synced 2025-07-04 06:10:18 +00:00
This commit is contained in:
Ian Gray
2021-12-28 17:13:25 +00:00
parent aa03c1683d
commit 777ceb2bed
3 changed files with 23 additions and 28 deletions

39
data/js/controls.js vendored
View File

@ -896,31 +896,24 @@ function switcher(number, state) {
}
var rangeSlider = function (isDiscrete) {
var slider = $(".range-slider"),
range = $(".range-slider__range"),
value = $(".range-slider__value");
var range = $(".range-slider__range");
var slidercb = function() {
sliderchange($(this).attr("id").replace(/^\D+/g, ""));
};
slider.each(function () {
value.each(function () {
var value = $(this).prev().attr("value");
$(this).html(value);
});
range.on({input: function() {
$(this).next().html(this.value)}
});
if (!isDiscrete) {
range.on({
input: function () {
sliderchange($(this).attr("id").replace(/^\D+/g, ""));
},
});
} else {
range.on({
input: function () {
$(this).next().html(this.value);
},
change: function () {
sliderchange($(this).attr("id").replace(/^\D+/g, ""));
},
});
range.each(function() {
$(this).next().html(this.value);
if($(this).attr("callbackSet") != "true") {
if (!isDiscrete) {
$(this).on({input: slidercb}); //input fires when dragging
} else {
$(this).on({change: slidercb}); //change fires only once released
}
$(this).attr("callbackSet", "true");
}
});
};