Skip to content

Page calculation wrong when using slidesPerView, slidesPerGroup and loop together #6412

Closed
@johnson0903

Description

Check that this is really a bug

  • I confirm

Reproduction link

https://codesandbox.io/p/sandbox/swiper-infinite-loop-forked-16hmxz?file=%2Findex.html&selection=%5B%7B%22endColumn%22%3A18%2C%22endLineNumber%22%3A80%2C%22startColumn%22%3A18%2C%22startLineNumber%22%3A80%7D%5D

Bug description

When using loop mode, If I have 5 slides and set both slidesPerView and slidesPerGroup to 2, the page result is not correct after navigate back and forth several times. And the result in each page is not stable after the loop happens.

Expected Behavior

After clicking next button twice to navigate to the third page, the active page dot should be the third one.

And if I click the prev button now, it should show slide 3 and slide 4

Actual Behavior

After clicking next button twice to navigate to the third page (showing slide 4 and slide 5), the active page dot is the second one instead of the third one.

Then if I click the prev button now, the active page dot go back to the first one, but now it shows slide 2 and slide 3 instead of slide 3 and slide 4

Swiper version

version 9.0.5

Platform/Target and Browser Versions

macOS chrome

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

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions