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

Loop doesn't work as expected depending on number of slides and slidesPerView ratio. #6752

Closed
5 of 6 tasks
MattyyttaM opened this issue Jun 13, 2023 · 1 comment
Closed
5 of 6 tasks
Labels

Comments

@MattyyttaM
Copy link

MattyyttaM commented Jun 13, 2023

Check that this is really a bug

  • I confirm

Reproduction link

https://codesandbox.io/p/sandbox/swiper-react-default-forked-8x9lqk?file=%2Fsrc%2FApp.jsx%3A24%2C1

Bug description

Depending on the number of slides in the carousel and the slides per view set, the loop behaviour doesn't loop when you get to the last slide, navigation from right to left.

I can't say for sure, but it only seems to be when the slides per view doesn't divid nicely into the number of sliders.

For example, with 6 slide and 4 slides per view, the loop doesn't work. However if you set the slides per view to 3, it does.

Tested with versions

  • 9.4.0
  • 9.3.2
  • 9.2.1
  • 9.2.0
  • 9.0.0

Expected Behavior

For the carousel to loop regardless of this slides to slides per view ratio.

Actual Behavior

Carousel doesn't loop when reaching the end going from right to left.

Swiper version

9.4.0

Platform/Target and Browser Versions

macOS, Chrome Version 114.0.5735.106 (Official Build) (arm64) & MacOS, Firefox 114.0.1 (64-bit)

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
Repository owner deleted a comment from imagine10255 Jun 13, 2023
@nolimits4web
Copy link
Owner

https://swiperjs.com/swiper-api#param-loop

Because of nature of how the loop mode works (it will rearrange slides), total number of slides must be >= slidesPerView * 2

Repository owner locked and limited conversation to collaborators Jun 13, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants