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

Fix slider interval stacking issue for smoother transitions #388

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

vishalnadarge
Copy link

Description: This pull request addresses an issue with the automatic interval for the slider in script.js. Previously, each manual interaction with the slider would restart the interval, causing multiple intervals to stack, resulting in lagging animations and poor performance.

Changes Made:

Refactored the slider code to initialize the interval only once, preventing multiple intervals from overlapping.
Moved the setInterval function outside of reloadSlider and created a separate startSliderInterval function that runs only once upon page load.
Improved code readability and maintainability by keeping the interval separate from user interactions.
Impact:

Enhances performance by ensuring only a single interval manages the slider’s automatic transitions.
Prevents stacking issues, resulting in smoother animations and reduced resource usage.
Testing:

Verified the slider functions correctly with a 3-second interval for automatic transitions.
Tested "Next" and "Previous" button functionality to confirm manual navigation doesn’t interfere with the interval.
Checked responsive behavior to ensure the slider repositions correctly on window resize.

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉 Thank you @vishalnadarge for your contribution! Your pull request has been submitted successfully. A maintainer will review it as soon as possible. We appreciate your support in making this project better

Copy link
Owner

@Harshdev098 Harshdev098 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

its not working also the left btn is not visible

Screencast.from.2024-11-04.07-47-37.mp4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants