#7994·swiper

Autoheight with "auto" slidesPerView

Author: mariuswestgaardCreated May 21, 2025Updated Aug 8, 2026

Check that this is really a bug

  • I confirm

Reproduction link

none

Bug description

When autoHeight is enabled, and slidesPerView is "auto" the height is not updating on the last slide, if the last slide is less than 2/3 of the swiper container (not wrapper). If the last slide is more than 2/3 of the swiper container, the height is resizing as it should.

Here's an image when it works as it should (last item is more than 2/3 of width), and all four lines are displayed: Image

Here's an image when it does not work as it should (last item is less then 2/3 of width), and only 3 lines are displayed (previous slide has 3 lines): Image

Expected Behavior

When swiper is swiped to the last slide the height of the container should reflect the last item height, not the second to last item.

Actual Behavior

If the last slide is less than 2/3 of the swiper container (not wrapper), the height does not update.

Swiper version

11.2.7

Platform/Target and Browser Versions

macOS Chrome (v 136.0.7103.114)

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