Skip to content

Commit

Permalink
fix(controller): fix issues with loop mode
Browse files Browse the repository at this point in the history
fixes #6659
  • Loading branch information
nolimits4web committed Aug 8, 2023
1 parent db9b17f commit fbb84fe
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/core/loop/loopFix.mjs
Expand Up @@ -148,21 +148,28 @@ export default function loopFix({
if (swiper.controller && swiper.controller.control && !byController) {
const loopParams = {
slideRealIndex,
slideTo: false,
direction,
setTranslate,
activeSlideIndex,
byController: true,
};
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,
});
}
}

Expand Down

0 comments on commit fbb84fe

Please sign in to comment.