Skip to content

Commit

Permalink
fix: centeredSlides with centeredSlidesBounds don't work correct when…
Browse files Browse the repository at this point in the history
… slidesPerView: 'auto' and width of the swiper-container bigger then width of slides (#7696)
  • Loading branch information
AzA-95 authored Aug 26, 2024
1 parent b7d4a11 commit c11172a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/core/update/updateSlides.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ export default function updateSlides() {
allSlidesSize += slideSizeValue + (spaceBetween || 0);
});
allSlidesSize -= spaceBetween;
const maxSnap = allSlidesSize - swiperSize;
const maxSnap = allSlidesSize > swiperSize ? allSlidesSize - swiperSize : 0;
snapGrid = snapGrid.map((snap) => {
if (snap <= 0) return -offsetBefore;
if (snap > maxSnap) return maxSnap + offsetAfter;
Expand Down

0 comments on commit c11172a

Please sign in to comment.