diff --git a/src/core/slide/slideTo.mjs b/src/core/slide/slideTo.mjs index 133d295bb..d79e983fc 100644 --- a/src/core/slide/slideTo.mjs +++ b/src/core/slide/slideTo.mjs @@ -93,8 +93,14 @@ export default function slideTo(index = 0, speed, runCallbacks = true, internal, else if (slideIndex < activeIndex) direction = 'prev'; else direction = 'reset'; + // initial virtual + const isVirtual = swiper.virtual && swiper.params.virtual.enabled; + const isInitialVirtual = isVirtual && initial; // Update Index - if ((rtl && -translate === swiper.translate) || (!rtl && translate === swiper.translate)) { + if ( + !isInitialVirtual && + ((rtl && -translate === swiper.translate) || (!rtl && translate === swiper.translate)) + ) { swiper.updateActiveIndex(slideIndex); // Update Height if (params.autoHeight) { @@ -114,7 +120,6 @@ export default function slideTo(index = 0, speed, runCallbacks = true, internal, const isH = swiper.isHorizontal(); const t = rtl ? translate : -translate; if (speed === 0) { - const isVirtual = swiper.virtual && swiper.params.virtual.enabled; if (isVirtual) { swiper.wrapperEl.style.scrollSnapType = 'none'; swiper._immediateVirtual = true;