Skip to content

Commit c11172a

Browse files
authored
fix: centeredSlides with centeredSlidesBounds don't work correct when slidesPerView: 'auto' and width of the swiper-container bigger then width of slides (#7696)
1 parent b7d4a11 commit c11172a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/core/update/updateSlides.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ export default function updateSlides() {
255255
allSlidesSize += slideSizeValue + (spaceBetween || 0);
256256
});
257257
allSlidesSize -= spaceBetween;
258-
const maxSnap = allSlidesSize - swiperSize;
258+
const maxSnap = allSlidesSize > swiperSize ? allSlidesSize - swiperSize : 0;
259259
snapGrid = snapGrid.map((snap) => {
260260
if (snap <= 0) return -offsetBefore;
261261
if (snap > maxSnap) return maxSnap + offsetAfter;

0 commit comments

Comments
 (0)