【问题标题】:Is there a way of disable navigation on ngx-swiper-wrapper when there's only 1 slide?当只有一张幻灯片时,有没有办法在 ngx-swiper-wrapper 上禁用导航?
【发布时间】:2019-06-26 16:51:19
【问题描述】:

我有一个带有多个滑动器的应用程序,幻灯片是由不同的服务器动态生成的。 如果滑动条上只有 1 张幻灯片,我需要禁用导航和分页(没有项目符号或滑动条效果)。

我做了一些谷歌研究,直到现在我只找到了 Jquery 的答案。我不允许使用 Jquery,只能使用打字稿。 我尝试使用“document.querySelectorAll('.slider').length == 1”创建条件,但在 DOM 上找不到“slider”,因此始终返回 0。

【问题讨论】:

    标签: typescript slider angular6 swiper


    【解决方案1】:

    所以我坚持了 2 天,终于找到了答案,就像在 swiper 配置中添加“watchOverflow:true”一样简单:

     public config: SwiperConfigInterface = {
        slidesPerView: 1.16,
        spaceBetween: 4,
        centeredSlides: true,
        mousewheel: true,
        scrollbar: false,
        navigation: false,
        pagination: true,
        watchOverflow: true
      };
    

    【讨论】:

      猜你喜欢
      • 2017-03-04
      • 2020-06-30
      • 2020-11-19
      • 2022-10-06
      • 2020-03-18
      • 1970-01-01
      • 2021-01-11
      • 2020-08-15
      • 1970-01-01
      相关资源
      最近更新 更多