Skip to content

Add event firing for carousel index updates #617

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

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

Conversation

iqbl-nrkhls
Copy link

@iqbl-nrkhls iqbl-nrkhls commented Mar 26, 2025

This PR introduces event firing for carousel index updates, allowing developers to track changes when the user navigates through slides. This improves reactivity and integration with other UI components.

Changes:

  • Implemented event dispatching on index change

Why This is Needed:
Currently, there is no built-in way to detect slide changes in the carousel. With this feature, developers can listen for index updates and trigger custom actions, animations, or syncing external components.

Screenshot 2025-03-26 at 22 12 37-mh

How to use:

const instance = HSCarousel.getInstance("#carousel");

instance.on("update", (currentIndex) => {
  console.log(currentIndex);
});

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.

1 participant