Skip to content

Swiper loop issue when set to slidesPerView: 3, loop: true, and centeredSlides: true when only having 4 slides #7325

@jackkemmish

Description

@jackkemmish

Check that this is really a bug

  • I confirm

Reproduction link

https://codepen.io/jackkemm/pen/gOEyEKx

Bug description

I am wanting to loop a carousel when slides are more than 3, and whilst it loads okay, as soon as you resize the browser, the slides reshift and the prev slide disappears. This is true for when there are four slides for example, however when there are more than that it's okay.

I have cases where whilst slidesPerView is set to 3, I might have 4 slides but want to loop through them. I have tested by adding more and it then starts to work fine, but this is different to what it says in here Swiper back to basics - "minimum number of slides must be >= slidesPerView + slidesPerGroup"

In some cases i'd like to be able to loop through 3 slides when there are only 3 available slides too but that's another problem as I can't see no way in the docs to add in extra slides.

If I have slidesPerView set to 3, and have 4 slides, that fits within the boundaries?

Expected Behavior

I would expect by setting slidesPerView: 3 and having 4 slides for the looping functionality to work on resize.

Actual Behavior

Setting slidesPerView: 3 and having 4 slides for example, resizing the browser causes a shift in the slides to reorder and the prev slide disappears.

Swiper version

11.0.6

Platform/Target and Browser Versions

macOS - all browsers

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

Metadata

Assignees

No one assigned

    Labels

    t0gglesLinked to the t0ggles task

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions