ionic 3 图像滑块在手动滑动后停止自动播放 [英] ionic 3 image slider stops autoplay after manual sliding
本文介绍了ionic 3 图像滑块在手动滑动后停止自动播放的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Ionic 3 图像滑块自动播放效果很好,但是当我手动滑动图像时,自动播放停止工作.下面是我的 ionic 3 代码.我真的被困在这里了..
Ionic 3 image slider autoplay works well, but when I slide the image manually the autoplay stops working. Below is my ionic 3 code. I am really stuck here..
slideData = [{ image: "../../assets/img1.jpg" },{ image: "../../assets/img2.jpg" },{ image: "../../assets/img3.jpg" }]
html代码如下
<ion-slides class="slide-css" autoplay="100" loop="true" speed="100" pager="true" autoplayDisableOnInteraction = "false">
<ion-slide *ngFor="let slide of slideData">
<img src="{{slide.image}}" />
</ion-slide>
</ion-slides>
推荐答案
如果有人找到Ionic 4/5的解决方案,手动滑动后重新启动滑块只需定义如下:
If someone finds a solution for Ionic 4/5, to restart the slider after manual sliding just define like this:
slideOptsOne = {
initialSlide: 0,
slidesPerView: 1,
autoplay: {
disableOnInteraction: false
}
};
HTML:
<ion-slides [options]="slideOptsOne" color="tertiary">
参考:https://swiperjs.com/api/#autoplay干杯
这篇关于ionic 3 图像滑块在手动滑动后停止自动播放的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文