Issue centering active item when the active item is larger than inactive items #8122
Unanswered
stephenk98
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Description
I am building a swiper carousel where the active slide is larger than the inactive slides. The active slide is centered on initial load, but when I swipe to the left or right, the active image is then offset from the center to the left on a left swipe and to the right on a right swipe.
I have a codesandbox linked here that illustrates the issue in the preview: https://codesandbox.io/p/devbox/6hldyj
Below are some screenshots that illustrates the issue as well:
Initial Configuration

After left swipe

After right swipe

I have tried to trigger an update on the
slideChangeTransitionEndevent to recenter the slide. While this does center the slide, it has an undesirable effect where the slide "bounces" into place. Here's another codesandbox that illustrates the bounce effect: https://codesandbox.io/p/devbox/57j52k?migrateFrom=l78cprI don't know if this is an issue with the library, or the way I'm using it. Any advice or tips would be greatly appreciated!
Beta Was this translation helpful? Give feedback.
All reactions