Skip to content

Commit

Permalink
fix(core): don't fix the loop on simple resize
Browse files Browse the repository at this point in the history
fixes #7325
  • Loading branch information
nolimits4web committed Mar 28, 2024
1 parent c3f92dc commit 641793f
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/core/slide/slideToLoop.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,14 @@ export default function slideToLoop(index = 0, speed, runCallbacks = true, inter
}
}
let needLoopFix = cols - targetSlideIndex < slidesPerView;

if (centeredSlides) {
needLoopFix = needLoopFix || targetSlideIndex < Math.ceil(slidesPerView / 2);
}
if (internal && centeredSlides && swiper.params.slidesPerView !== 'auto' && !gridEnabled) {
needLoopFix = false;
}

if (needLoopFix) {
const direction = centeredSlides
? targetSlideIndex < swiper.activeIndex
Expand Down

0 comments on commit 641793f

Please sign in to comment.