From cf8cdf59aad733deccb19f5295fb90ab41b1c372 Mon Sep 17 00:00:00 2001 From: Vladimir Kharlampidi Date: Mon, 27 Feb 2023 17:09:41 +0300 Subject: [PATCH] fix(pagination): fix clickable pagination with slidesPerView > 1 and loop fixes #6415 --- src/modules/pagination/pagination.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/modules/pagination/pagination.js b/src/modules/pagination/pagination.js index 27e4f5c7d..887dc83ef 100644 --- a/src/modules/pagination/pagination.js +++ b/src/modules/pagination/pagination.js @@ -78,6 +78,15 @@ export default function Pagination({ swiper, extendParams, on, emit }) { e.preventDefault(); const index = elementIndex(bulletEl) * swiper.params.slidesPerGroup; if (swiper.params.loop) { + if (swiper.realIndex === index) return; + if (index < swiper.loopedSlides || index > swiper.slides.length - swiper.loopedSlides) { + swiper.loopFix({ + direction: index < swiper.loopedSlides ? 'prev' : 'next', + activeSlideIndex: index, + slideTo: false, + }); + } + swiper.slideToLoop(index); } else { swiper.slideTo(index);