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

centeredSlidesBounds has bugged behaviour depending on slide count and slidesPerView combo #6689

Closed
5 of 6 tasks
epetousis opened this issue May 19, 2023 · 0 comments
Closed
5 of 6 tasks

Comments

@epetousis
Copy link

epetousis commented May 19, 2023

Check that this is really a bug

  • I confirm

Reproduction link

https://codepen.io/evan_interdyn/pen/bGmQbVV

Bug description

If you set centeredSlidesBounds to true on a Swiper element, and have a certain amount of slides combined with a particular slidesPerView number, the left-right swiping seems to invert and behave very unpredictably.

I have observed this behaviour with the following slide counts and slidePerView combinations:

  • 5, 7
  • 2, 3
  • 5, 8

A possible workaround I've found is to set slidesPerView to a decimal value (e.g 3.1).

Expected Behavior

The Swiper wrapper starts at the left of its container, and doesn't attempt to centre the first slide.

Actual Behavior

The Swiper wrapper starts at the left sometimes, but swiping right to left causes the first slide to snap to the centre. Sometimes the wrapper will start centered on the first slide.

Swiper version

9.3.2

Platform/Target and Browser Versions

macOS Chrome 113.0.5672.92

Validations

  • Follow our Code of Conduct
  • Read the docs.
  • Check that there isn't already an issue that request the same feature to avoid creating a duplicate.
  • Make sure this is a Swiper issue and not a framework-specific issue

Would you like to open a PR for this bug?

  • I'm willing to open a PR
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