微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

角度 – 离子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

原文地址:https://www.jb51.cc/angularjs/141288.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐