From 3f5e05d59a776e2cfc3a709e4b230ff23191266c Mon Sep 17 00:00:00 2001 From: Vladimir Kharlampidi Date: Wed, 25 Oct 2023 11:32:30 +0300 Subject: [PATCH] fix(core): correctly handle loopAdditionalSlides parameter --- src/core/loop/loopFix.mjs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/core/loop/loopFix.mjs b/src/core/loop/loopFix.mjs index 438c4f6aa..0100c5d05 100644 --- a/src/core/loop/loopFix.mjs +++ b/src/core/loop/loopFix.mjs @@ -48,7 +48,8 @@ export default function loopFix({ if (loopedSlides % slidesPerGroup !== 0) { loopedSlides += slidesPerGroup - (loopedSlides % slidesPerGroup); } - swiper.loopedSlides = loopedSlides + params.loopAdditionalSlides; + loopedSlides += params.loopAdditionalSlides; + swiper.loopedSlides = loopedSlides; const gridEnabled = swiper.grid && params.grid && params.grid.rows > 1; if (slides.length < slidesPerView + loopedSlides) { @@ -101,10 +102,7 @@ export default function loopFix({ } } } else if (activeColIndexWithShift + slidesPerView > cols - loopedSlides) { - slidesAppended = Math.max( - activeColIndexWithShift - (cols - loopedSlides * 2), - slidesPerGroup, - ); + slidesAppended = Math.max(activeColIndexWithShift - (cols - loopedSlides * 2), slidesPerGroup); for (let i = 0; i < slidesAppended; i += 1) { const index = i - Math.floor(i / cols) * cols; if (gridEnabled) {