-
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
Open
Description
Check that this is really a bug
- I confirm
Reproduction link
https://codesandbox.io/s/swiper-bug-loop-centered-auto-width-kwj8ls?file=/index.html
Bug description
a slider with slidesPerView set to 'auto' in loop mode and centeredSlides set to true calculates the last slide as the active slide on load. In the demo you'll see that the first slide shown is slide 7, not slide 1.
-
changing the slide width in CSS from 20% to 21% causes the first slide to show.
-
can also play with initialSlide value to correct it.
My guess is some sort of math error when calculating the first slide when combo of slidesPerView 'auto', centeredSlides true, and loop mode are all in play.
Expected Behavior
- I expect Slide 1 to be the first to show in the provided example.
- I expect changing slide width in CSS to not change which slide is calculated to be first (i.e. I expect when initalSlide is set to 0, the first slide is shown.)
Actual Behavior
The last slide in the html is calculated to be the active slide on load.
Swiper version
11.0.5
Platform/Target and Browser Versions
Chrome, Safari
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
huggie1984, FedericoBarbieri, barugass, sectsect, 0x0m0t0 and 2 more
Metadata
Metadata
Assignees
Labels
No labels