From 3a12408a26e89570914fe3f3a7b055ff9f548f45 Mon Sep 17 00:00:00 2001 From: Oleg Skinder Date: Mon, 15 Apr 2019 11:51:47 +0300 Subject: [PATCH] Fix issue 992 --- src/components/slides/swiper/swiper.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/components/slides/swiper/swiper.ts b/src/components/slides/swiper/swiper.ts index 6e387b9f5..bf4f74ad4 100644 --- a/src/components/slides/swiper/swiper.ts +++ b/src/components/slides/swiper/swiper.ts @@ -725,6 +725,8 @@ export function fixLoop(s: Slides, plt: Platform) { export function slideTo(s: Slides, plt: Platform, slideIndex?: number, speed?: number, runCallbacks = true, internal?: boolean) { if (typeof slideIndex === 'undefined') slideIndex = 0; if (slideIndex < 0) slideIndex = 0; + if (slideIndex >= s._snapGrid.length) + slideIndex = s._snapGrid.length - 1; s._snapIndex = Math.floor(slideIndex / s.slidesPerGroup); if (s._snapIndex >= s._snapGrid.length) s._snapIndex = s._snapGrid.length - 1; @@ -744,7 +746,8 @@ export function slideTo(s: Slides, plt: Platform, slideIndex?: number, speed?: n // Directions locks if (!s._allowSwipeToNext && translate < s._translate && translate < minTranslate(s)) { - return false; + if ((s._activeIndex || s._snapGrid.length-1) !== slideIndex) + return false; } if (!s._allowSwipeToPrev && translate > s._translate && translate > maxTranslate(s)) { if ((s._activeIndex || 0) !== slideIndex ) return false;