I have a ionic slides and setup it autoplay, but when I touch to swipe the slide, it’s not autoplay anymore. How can I keep it autoplay even it be touched?
html:
<ion-slides #bannerSlides
pager="true"
autoplay="1000"
loop=false
(ionSlideAutoplayStop)="autoplaySlidesStop($event)"
(ionSlideWillChange)="slideWillChange($event)">
<ion-slide>
...
</ion-slide>
</ion-slides>
ts:
@ViewChild('bannerSlides') bannerSlidesRef: Slides;
...
autoplaySlidesStop(event): void {
if (this.bannerSlidesRef && this.bannerSlidesRef._slides.length > 1) {
this.bannerSlidesRef.startAutoplay();
}
}
...
slideWillChange(event): void {
if (this.bannerSlidesRef.getActiveIndex() > this.bannerSlidesRef._slides.length - 1) {
this.bannerSlidesRef._activeIndex = this.bannerSlidesRef._activeIndex - 1;
} else {
}
}