角度 – 离子3图像滑块在手动滑动后停止自动播放

前端之家收集整理的这篇文章主要介绍了角度 – 离子3图像滑块在手动滑动后停止自动播放前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
Ionic 3图像滑块自动播放效果很好,但是当我手动滑动图像时,自动播放停止工作.以下是我的离子3代码.我真的被困在这里..
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>
更新:

你需要像这样使用它:

import { Component,ViewChild } from '@angular/core';
import { IonicPage,NavController,NavParams,Slides } from 'ionic-angular';

@ViewChild(Slides) slides: Slides;

constructor(private navCtrl: NavController,private navParams: NavParams) {
  }

  ionViewDidEnter() {
    this.slides.autoplayDisableOnInteraction = false;
  }

注意:您需要在html页面删除autoplayDisableOnInteraction =“false”.

旧答案:

您可以使用autoplayDisableOnInteraction =“false”,如下所示.

<ion-slides  class="slide-css" autoplay="100" loop="true" speed="100" 
                 pager="true" autoplayDisableOnInteraction = "false">

    </ion-slides>

See how it implements on Ionic

Swiper API

disableOnInteraction boolean true Set to false and autoplay will not be disabled after user interactions (swipes),it will be restarted every time after interaction

猜你在找的Angularjs相关文章