zoukankan      html  css  js  c++  java
  • vue中使用swiper5缩略图

    引入Swiper

    import Swiper from "swiper";



    html

        <div class="swiper-container gallery-top">
                  <div class="swiper-wrapper">
                 
                    <div class="swiper-slide">2222</div>
                   <div class="swiper-slide">3333</div>
                  </div>
                  <!-- Add Arrows -->
                  <div
                    v-if="simulatedDATA.video||(!simulatedDATA.video&&simulatedDATA.images.length>1)"
                  >
                    <div class="swiper-button-next swiper-button-white"></div>
                    <div class="swiper-button-prev swiper-button-white"></div>
                  </div>
                </div>
                <!-- swiper -->
                <div class="swiper-container gallery-thumbs">
                  <div class="swiper-wrapper">
                  <div class="swiper-slide">2222</div>
                   <div class="swiper-slide">3333</div>
                  </div>
                </div>
                <!-- Add Arrows -->
                <div class="add_white_button">
                  <div class="arrows_left"></div>
                  <div class="arrows_right"></div>
                </div>                    
    

     
    实例加载完成后js

          let galleryThumbs = new Swiper(".gallery-thumbs", {
            freeMode: false,
            watchSlidesVisibility: true,
            spaceBetween: 2,  //边距
            touchRatio: 0.2, //滑动占比
            slidesPerView: 6,
            loopedSlides: 6,
            loop: false,  //无限切换
            slideToClickedSlide: true,
            watchSlidesProgress: true,
            navigation: {
              nextEl: ".arrows_left",
              prevEl: ".arrows_right"
            }
          });
          let galleryTop = new Swiper(".gallery-top", {
            loop: true,
            spaceBetween: 0,
            loopedSlides: 6,
            speed: 1000,
            allowTouchMove: true,
            // hideOnClick: true,
            navigation: {
              nextEl: ".swiper-button-next",
              prevEl: ".swiper-button-prev"
            },
            thumbs: {
              swiper: galleryThumbs
            }
          });
    

      最后引入样式

  • 相关阅读:
    关于ArcGis for javascrept查询ArcGis server图层信息的方式
    Elasticsearch教程之基础概念
    C# 将日期转换成中文格式
    .Net 自定义Excel模板导出数据
    JavaScript判断浏览器类型
    简单的json传送数据
    Oracle替换临时表空间
    Python多线程循环
    crontab执行不生效-【问题篇】
    Python将MySQL表数据写入excel
  • 原文地址:https://www.cnblogs.com/lan-cheng/p/12539580.html
Copyright © 2011-2022 走看看