【问题标题】:My coverflow effect for the slider is not working in Ionic 4我的滑块覆盖流效果在 Ionic 4 中不起作用
【发布时间】:2019-10-14 13:56:34
【问题描述】:

我正在使用我的 Ionic 4 应用程序,我已将封面流效果添加到我的滑块中,但它无法正常工作。

这是我的tab1.page.html

<ion-slides class="swiper-container swiper-container-3d" pager="false" [options]="slidesOpts" #slides>
    <ion-slide class="swiper-wrapper">
    </ion-slide>

    <ion-slide class="swiper-wrapper">
    </ion-slide>

   <ion-slide class="swiper-wrapper">
   </ion-slide>

   <ion-slide class="swiper-wrapper">
   </ion-slide>

</ion-slides>

这是我的tab1.page.ts

import { IonSlides } from '@ionic/angular';

@ViewChild('slides') slides: IonSlides;
  slidesOpts = {
    effect: 'coverflow',
    spaceBetween: 0,
    initialSlide: 1,
    slidesPerView : 2.6,
    slidesOffsetBefore: 11,
    slidesOffsetAfter: 11,
    direction: 'horizontal',
    centeredSlides: true,
    coverflowEffect: {
     rotate: 20,
     stretch: 20,
     depth: 200,
     shadow: true,
     slideShadows: true,
     shadowOffset: 20,
     modifier: 1,
    } 
  };

但它没有显示覆盖流效果。它正在显示简单的效果滑块。

非常感谢任何帮助。

【问题讨论】:

    标签: ionic-framework ionic4


    【解决方案1】:

    我已经通过引用这个Ionic documentation解决了。

    你可以试试这个。

    并且如下所述改变持续时间,

    setTransition(duration) {
       duration = 2000;
    }
    

    【讨论】:

      【解决方案2】:

      我已经通过参考 Ionic 团队 Github 解决了

      试试这个可能对你有帮助:https://codepen.io/liamdebeasi/pen/vYYEwZM

      我刚刚删除了这两行

      let slides = document.querySelector('ion-slides');
      slides.options = slideOpts;
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2014-01-13
        • 2012-07-28
        • 2015-06-18
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2018-01-20
        相关资源
        最近更新 更多