Skip to content

Commit

Permalink
fix(core): correctly handle loopAdditionalSlides parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
nolimits4web committed Oct 25, 2023
1 parent c44abb4 commit 3f5e05d
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/core/loop/loopFix.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 3f5e05d

Please sign in to comment.