Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DEX-17085 fixed loading bar intervals overlapping #460

Merged
merged 2 commits into from
Feb 6, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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