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

Initial carousel position and current index not working when using big scroll-hint #2300

Open
oncode opened this issue Dec 5, 2024 · 0 comments
Labels
bug Things that aren't working right in the library.

Comments

@oncode
Copy link

oncode commented Dec 5, 2024

Describe the bug

When I'm using a carousel with three items and showing two (slides-per-page="2") and setting a big scroll hint (--scroll-hint: 200px), on reload the carousel scroll-container seems to scroll to the right side (when browser width is e.g. 900px). Also when scrolling back or forth, the current index doesn't update. Maybe the problem is that the third item is already full in-view?
For context, I'm trying to create a carousel that is inside a container, but breaks out left/right with the scroll-hint property and negative margin-left/right.

To Reproduce

Open codepen, set the browser width to 900px and reload.

Demo

https://codepen.io/oncode_pens/pen/RNbrWBm

Screenshots

After loading the codepen carousel is scrolled completely to the right and currentIndex is 0:
Screenshot 2024-12-05 at 01 18 55

Expected initial position of the carousel (0) and when scrolled to right the currentIndex should be 1:
Screenshot 2024-12-05 at 01 19 03

Browser / OS

  • OS: Mac 12.5
  • Browser: Chrome
  • Browser version: 131
@oncode oncode added the bug Things that aren't working right in the library. label Dec 5, 2024
@oncode oncode changed the title Carousel Initial Carousel position not working when using big scroll-hint Dec 5, 2024
@oncode oncode changed the title Initial Carousel position not working when using big scroll-hint Initial carousel position not working when using big scroll-hint Dec 5, 2024
@oncode oncode changed the title Initial carousel position not working when using big scroll-hint Initial carousel position and current index not working when using big scroll-hint Dec 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Things that aren't working right in the library.
Projects
None yet
Development

No branches or pull requests

1 participant