File: /var/www/quadcode/frontend/src/js/components/lp/white_label_brokerage/inputRange.js
const sliderEl = document.querySelector("[type='range']");
const sliderValue = document.querySelectorAll(".block-howMuchCanYouEarn__cardItemIndicator");
const infoIcon = document.querySelector('.block-howMuchCanYouEarn__infoIcon')
const infoTooltip = document.getElementById('infoTooltip');
changeSliderColor(sliderEl.value);
inputTooltip();
sliderEl.addEventListener("input", (event) => {
changeSliderColor(event.target.value);
});
function changeSliderColor(tempSliderValue) {
sliderValue[0].textContent = tempSliderValue;
sliderValue[1].textContent = `$${new Intl.NumberFormat("en-US").format(tempSliderValue * 270)}`;
const progress = (tempSliderValue / sliderEl.max) * 100;
sliderEl.style.background = `linear-gradient(to right, #445667 ${progress}%, #CFDAE1 ${progress}%)`;
}
function inputTooltip () {
infoIcon.addEventListener('mouseenter', (event) => {
event.stopPropagation();
infoTooltip.classList.add('active');
})
infoIcon.addEventListener('mouseleave', (event) => {
infoTooltip.classList.remove('active');
})
}