Skip to content

Commit

Permalink
Merge pull request #460 from bitdefender/DEX-17085
Browse files Browse the repository at this point in the history
DEX-17085 fixed loading bar intervals overlapping
  • Loading branch information
abutuza authored Feb 6, 2025
2 parents b581c83 + 9db90b5 commit b01c865
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions _src-lp/scripts/scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -1094,16 +1094,18 @@ function eventOnDropdownSlider() {
const loadingBars = slider.querySelectorAll('.loading-bar');
let activeIndex = 0;
let interval;
let loadingInterval;

function showLoadingBar(index) {
clearInterval(loadingInterval); // Clear any existing loading animation
const loadingBar = loadingBars[index];
loadingBar.style.width = '0';
let width = 0;
const interval2 = setInterval(() => {
loadingInterval = setInterval(() => {
width += 1;
loadingBar.style.width = `${width}%`;
if (width >= 100) {
clearInterval(interval2);
clearInterval(loadingInterval);
}
}, 30); // Adjust the interval for smoother animation
}
Expand All @@ -1123,6 +1125,7 @@ function eventOnDropdownSlider() {
}

function startAutomaticMovement() {
clearInterval(interval);
interval = setInterval(moveToNextItem, 4000); // Set the interval
}

Expand Down

0 comments on commit b01c865

Please sign in to comment.