Skip to content

centeredSlides = 'true' and .swiper-slide { width: auto; } make the slider start at the last image with missing images to the right #5074

@Stanzi1791

Description

@Stanzi1791

Hi,

When I'm using centeredSlides = 'true' in combination with .swiper-slide { width: auto; }
the slider starts with the last image centered, images to the right of the centered image are missing.

After the first autoplay "move", the first image is centered and the images to the right are loaded,
this is the state I would have expected Swiper to start in.

Fiddle here (the first image is the green one):
https://jsfiddle.net/wq7j8Lep/2/ (you may have to refresh the page to see the behaviour above)

The fiddle uses Swiper 7.0.8, but I've also seen this behaviour in Swiper version 5.3.6.

If I turn off autoplay and look at the html, it looks like the "swiper-slide-active" class is getting assigned to the wrong slide (the last one) when the page first loads. Did I use the plugin wrong or is there a workaround for this?

Kind regards,
Marleen

Metadata

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