improve pip classList add/remove with no intermediary variable
This commit is contained in:
@@ -322,20 +322,13 @@ For extra details about options and events take a look here: https://refreshless
|
||||
});
|
||||
}
|
||||
function setUpActivePipsHandling() {
|
||||
let activePip = [null, null];
|
||||
sliderInstance.noUiSlider.on('update', function (values,handle) {
|
||||
if(activePip[handle]){
|
||||
activePip[handle].classList.remove("noUi-value-active");
|
||||
}
|
||||
sliderInstance.querySelectorAll('.noUi-value').forEach(pip => {
|
||||
pip.classList.remove("noUi-value-active");
|
||||
if (Number(values[handle]) === Number(pip.getAttribute('data-value'))) {
|
||||
activePip[handle] = pip;
|
||||
pip.classList.add("noUi-value-active");
|
||||
}
|
||||
});
|
||||
|
||||
if (activePip[handle]) {
|
||||
activePip[handle].classList.add("noUi-value-active");
|
||||
}
|
||||
});
|
||||
}
|
||||
function addPipClickHandler(){
|
||||
|
||||
@@ -54,20 +54,13 @@ angular.module("umbraco.install").controller("Umbraco.Install.UserController", f
|
||||
|
||||
const pips = consentSlider.querySelectorAll('.noUi-value');
|
||||
|
||||
let activePip = [null, null];
|
||||
consentSlider.noUiSlider.on('update', function (values,handle) {
|
||||
if(activePip[handle]){
|
||||
activePip[handle].classList.remove("noUi-value-active");
|
||||
}
|
||||
consentSlider.querySelectorAll('.noUi-value').forEach(pip => {
|
||||
pip.classList.remove("noUi-value-active");
|
||||
if (Number(values[handle]) === Number(pip.getAttribute('data-value'))) {
|
||||
activePip[handle] = pip;
|
||||
pip.classList.add("noUi-value-active");
|
||||
}
|
||||
});
|
||||
|
||||
if (activePip[handle]) {
|
||||
activePip[handle].classList.add("noUi-value-active");
|
||||
}
|
||||
});
|
||||
|
||||
$(consentSlider).on('$destroy', function () {
|
||||
|
||||
Reference in New Issue
Block a user