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

Dots current index not updated on mount #123

Open
abynim opened this issue Nov 24, 2022 · 0 comments
Open

Dots current index not updated on mount #123

abynim opened this issue Nov 24, 2022 · 0 comments

Comments

@abynim
Copy link

abynim commented Nov 24, 2022

If the initialPageIndex prop is set to anything over 0, while the Carousel's content renders the correct page, the Dots always show the first Dot as selected.

Looks like the currentPageIndex in the Carousel is not set on mount.
https://github.com/vadimkorr/svelte-carousel/blob/main/src/components/Carousel/Carousel.svelte#L204

Setting the currentPageIndex to match initialPageIndex on mount seems to fix it, but I don't know if that is the appropriate solution!

// Carousel.svelte Line 204

methods.showPage(initialPageIndex, { animated: false })
currentPageIndex = initialPageIndex; // Added this line
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

No branches or pull requests

1 participant