Skip to content

Commit

Permalink
fix(core): fix loop missing slides with centeredSlides
Browse files Browse the repository at this point in the history
fixes #7584
  • Loading branch information
nolimits4web committed Jul 31, 2024
1 parent 82ae434 commit 4847fcb
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/core/events/onTouchMove.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,12 @@ export default function onTouchMove(event) {
data.allowThresholdMove &&
data.currentTranslate >
(params.centeredSlides
? swiper.minTranslate() - swiper.slidesSizesGrid[swiper.activeIndex + 1]
? swiper.minTranslate() -
swiper.slidesSizesGrid[swiper.activeIndex + 1] -
(params.slidesPerView !== 'auto' && swiper.slides.length - params.slidesPerView >= 2
? swiper.slidesSizesGrid[swiper.activeIndex + 1] + swiper.params.spaceBetween
: 0) -
swiper.params.spaceBetween
: swiper.minTranslate())
) {
swiper.loopFix({ direction: 'prev', setTranslate: true, activeSlideIndex: 0 });
Expand All @@ -248,7 +253,13 @@ export default function onTouchMove(event) {
data.allowThresholdMove &&
data.currentTranslate <
(params.centeredSlides
? swiper.maxTranslate() + swiper.slidesSizesGrid[swiper.slidesSizesGrid.length - 1]
? swiper.maxTranslate() +
swiper.slidesSizesGrid[swiper.slidesSizesGrid.length - 1] +
swiper.params.spaceBetween +
(params.slidesPerView !== 'auto' && swiper.slides.length - params.slidesPerView >= 2
? swiper.slidesSizesGrid[swiper.slidesSizesGrid.length - 1] +
swiper.params.spaceBetween
: 0)
: swiper.maxTranslate())
) {
swiper.loopFix({
Expand Down

0 comments on commit 4847fcb

Please sign in to comment.