From fbb84fed425f8341c0bd927e5a658962b130abdf Mon Sep 17 00:00:00 2001 From: Vladimir Kharlampidi Date: Tue, 8 Aug 2023 17:53:03 +0300 Subject: [PATCH] fix(controller): fix issues with loop mode fixes #6659 --- src/core/loop/loopFix.mjs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/core/loop/loopFix.mjs b/src/core/loop/loopFix.mjs index 7ce01e136..4d724b034 100644 --- a/src/core/loop/loopFix.mjs +++ b/src/core/loop/loopFix.mjs @@ -148,7 +148,6 @@ export default function loopFix({ if (swiper.controller && swiper.controller.control && !byController) { const loopParams = { slideRealIndex, - slideTo: false, direction, setTranslate, activeSlideIndex, @@ -156,13 +155,21 @@ export default function loopFix({ }; if (Array.isArray(swiper.controller.control)) { swiper.controller.control.forEach((c) => { - if (!c.destroyed && c.params.loop) c.loopFix(loopParams); + if (!c.destroyed && c.params.loop) + c.loopFix({ + ...loopParams, + slideTo: c.params.slidesPerView === params.slidesPerView ? slideTo : false, + }); }); } else if ( swiper.controller.control instanceof swiper.constructor && swiper.controller.control.params.loop ) { - swiper.controller.control.loopFix(loopParams); + swiper.controller.control.loopFix({ + ...loopParams, + slideTo: + swiper.controller.control.params.slidesPerView === params.slidesPerView ? slideTo : false, + }); } }