zoukankan      html  css  js  c++  java
  • swiper在一个页面多个轮播图

    <script>
        var swiper = new Swiper('.swiper-container1', {
            spaceBetween: 30,
            centeredSlides: true,
            autoplay: {
                delay: 2500,
                disableOnInteraction: false,
            },
            pagination: {
                el: '.swiper-pagination1',
                clickable: true,
            },
            navigation: {
                nextEl: '.swiper-button-next',
                prevEl: '.swiper-button-prev',
            },
        });
    </script>
    
    <script>
        var swiper2 = new Swiper('.swiper-container2', {
            slidesPerView: 4,
            spaceBetween: 30,
            slidesPerGroup: 4,
            loop: true,
            autoplay: {
                delay: 2500,
                disableOnInteraction: false,
            },
            loopFillGroupWithBlank: true,
            pagination: {
                el: '.swiper-pagination2',
                clickable: true,
            },
            navigation: {
                nextEl: '.swiper-button-next',
                prevEl: '.swiper-button-prev',
            },
        });
    </script>
    

    注意: 千万不要直接更改swiper-container 应该在后面加上所起的名称

    <div class="swiper-container swiper-container1">
        <div class="swiper-wrapper">
            <div class="swiper-slide"><img src="img/banner.png" width="100%" 
    
    height="328px"></div>
            <div class="swiper-slide"><img src="img/banner.png" width="100%" 
    
    height="328px"></div>
            <div class="swiper-slide"><img src="img/banner.png" width="100%" 
    
    height="328px"></div>
            <div class="swiper-slide"><img src="img/banner.png" width="100%" 
    
    height="328px"></div>
        </div>
        <!-- Add Pagination -->
        <div class="swiper-pagination swiper-pagination1"></div>
        <!-- Add Arrows -->
        <div class="swiper-button-next"></div>
        <div class="swiper-button-prev"></div>
    </div>
    
        <div class="swiper-container swiper-container2">
            <div class="swiper-wrapper">
                <div class="swiper-slide success-item"><img src="img/book3.png"></div>
                <div class="swiper-slide success-item"><img src="img/biaozhi.png"></div>
                <div class="swiper-slide success-item"><img src="img/biaozhi.png"></div>
                <div class="swiper-slide success-item"><img src="img/biaozhi.png"></div>
                <div class="swiper-slide success-item"><img src="img/biaozhi.png"></div>
                <div class="swiper-slide success-item"><img src="img/book3.png"></div>
                <div class="swiper-slide success-item"><img src="img/biaozhi.png"></div>
                <div class="swiper-slide success-item"><img src="img/biaozhi.png"></div>
                <div class="swiper-slide success-item"><img src="img/biaozhi.png"></div>
            </div>
            <!-- Add Pagination -->
            <div class="swiper-pagination swiper-pagination2"></div>
            <!-- Add Arrows -->
            <div class="swiper-button-next"></div>
            <div class="swiper-button-prev"></div>
        </div>
    
  • 相关阅读:
    8种CSS清除浮动的方法优缺点分析
    link和@import的区别
    删除表及删除表中数据的方法
    【HTML5】---【HTML5提供的一些新的标签用法以及和HTML 4的区别】
    【HTML】---HTML语义化
    【HTML5】页面点击按钮添加一行 删除一行 全选 反选 全不选
    第四篇:python 高级之面向对象初级
    第三篇:python高级之生成器&迭代器
    第二篇:python高级之装饰器
    第一篇:python高级之函数
  • 原文地址:https://www.cnblogs.com/vientiane/p/9938560.html
Copyright © 2011-2022 走看看