ionic 3 image slider stops autoplay after manual sliding

前端 未结 3 493
时光取名叫无心
时光取名叫无心 2021-01-17 15:20

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..

         


        
3条回答
  •  渐次进展
    2021-01-17 16:05

    I used the following code and it is working fine and as expected:

    // in your .ts file

    slideOptsOne = {
        initialSlide: 0,
        slidesPerView: 1,
        autoplay: {
          delay: 3000,
          disableOnInteraction: false
        }
    
      };
    

    And in your HTML -

    
    

    Note: I am NOT even referencing the slider in my .ts file and calling autoplay on slidesDidLoad event as follows:

    slidesDidLoad(slides: IonSlides) {
       slides.startAutoplay();
    }
    

提交回复
热议问题