Skip to content

Commit

Permalink
fix(core): centerInsuffientSlides takes offsets into account (#7437)
Browse files Browse the repository at this point in the history
  • Loading branch information
slemling authored May 13, 2024
1 parent 51c90cf commit 5a271ff
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/core/update/updateSlides.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -269,8 +269,9 @@ export default function updateSlides() {
allSlidesSize += slideSizeValue + (spaceBetween || 0);
});
allSlidesSize -= spaceBetween;
if (allSlidesSize < swiperSize) {
const allSlidesOffset = (swiperSize - allSlidesSize) / 2;
const offsetSize = (params.slidesOffsetBefore || 0) + (params.slidesOffsetAfter || 0);
if (allSlidesSize + offsetSize < swiperSize) {
const allSlidesOffset = (swiperSize - allSlidesSize - offsetSize) / 2;
snapGrid.forEach((snap, snapIndex) => {
snapGrid[snapIndex] = snap - allSlidesOffset;
});
Expand Down

0 comments on commit 5a271ff

Please sign in to comment.