0

Below is working

<swiper-container id="swiper" (transitionstart)="slideTransitionStart()" #swiper>
            <swiper-slide *ngFor="let image of bannerList">
                <img [src]="image.picturePath | sanitizer" />
            </swiper-slide>
</swiper-container>

slideTransitionStart() {
        const mySwiper = new Swiper('#swiper');
        mySwiper.slideTo(1);
}

Below is not working

<swiper-container id="swiper" (transitionstart)="slideTransitionStart()" #swiper>
            <swiper-slide *ngFor="let image of bannerList">
                <img [src]="image.picturePath | sanitizer" />
            </swiper-slide>
</swiper-container>

slideTransitionStart() {
        const mySwiper = new Swiper('#swiper');
        mySwiper.slideTo(0);
}

When I am on the second slide and try to swipe the slide using mySwiper.slideTo(1), It stays in the same slide and that is what I expect but when I am on the first slide and try to swipe the slide using mySwiper.slideTo(0), It does not stay on the same slide and move to the next slide. So it needs to be on the same slide.

0 Answers0