diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/components/umbrangeslider.directive.js b/src/Umbraco.Web.UI.Client/src/common/directives/components/umbrangeslider.directive.js index 262f70f62b..8f6ad20fea 100644 --- a/src/Umbraco.Web.UI.Client/src/common/directives/components/umbrangeslider.directive.js +++ b/src/Umbraco.Web.UI.Client/src/common/directives/components/umbrangeslider.directive.js @@ -139,6 +139,8 @@ For extra details about options and events take a look here: https://refreshless }); setUpCallbacks(); + setUpActivePipsHandling(); + addPipClickHandler(); // Refresh the scope $scope.$applyAsync(); @@ -299,7 +301,28 @@ 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 => { + if (Number(values[handle]) === Number(pip.getAttribute('data-value'))) { + activePip[handle] = pip; + } + }); + activePip[handle].classList.add("noUi-value-active"); + }); + } + function addPipClickHandler(){ + sliderInstance.querySelectorAll('.noUi-value').forEach(function(pip){ + pip.addEventListener('click', function () { + const value = pip.getAttribute('data-value'); + sliderInstance.noUiSlider.set(value); + }); + }); + } } angular.module('umbraco.directives').component('umbRangeSlider', umbRangeSlider); diff --git a/src/Umbraco.Web.UI.Client/src/installer/steps/user.controller.js b/src/Umbraco.Web.UI.Client/src/installer/steps/user.controller.js index b4aa8eedf5..6028fb48c5 100644 --- a/src/Umbraco.Web.UI.Client/src/installer/steps/user.controller.js +++ b/src/Umbraco.Web.UI.Client/src/installer/steps/user.controller.js @@ -58,6 +58,19 @@ 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 => { + if (Number(values[handle]) === Number(pip.getAttribute('data-value'))) { + activePip[handle] = pip; + } + }); + activePip[handle].classList.add("noUi-value-active"); + }); + $(consentSlider).on('$destroy', function () { consentSlider.noUiSlider.off(); }); diff --git a/src/Umbraco.Web.UI.Client/src/installer/steps/user.html b/src/Umbraco.Web.UI.Client/src/installer/steps/user.html index 9049512c8c..7f9d568d70 100644 --- a/src/Umbraco.Web.UI.Client/src/installer/steps/user.html +++ b/src/Umbraco.Web.UI.Client/src/installer/steps/user.html @@ -47,7 +47,7 @@