swiper轮播图

余生长醉 提交于 2019-11-27 03:12:45

引入css,js

 <script src="http://www.swiper.com.cn/dist/js/swiper.min.js"></script>

 <link href="http://www.swiper.com.cn/dist/css/swiper.min.css" />

html内容

    <div class="swiper-container">
        <div class="swiper-wrapper">
            <div class="swiper-slide">
                <img src="https://www.swiper.com.cn/templets/default/images/home/iphoneX.png" class="topbox">
            </div>
            <div class="swiper-slide">
                <img src=" https://www.swiper.com.cn/templets/default/images/home/iphone8.png" class="topbox">
            </div>
            <div class="swiper-slide">
                <img src="https://www.swiper.com.cn/templets/default/images/home/ipad.png" class="topbox">
            </div>
        </div>
    </div>
    <div class="page">
        <div class="pagination"></div>
    </div>

 

js内容

var mySwiper = new Swiper('.swiper-container', {
    loop: true, //环路
    direction: 'horizontal', // 横向切换
    autoplay: { //自动切换
        delay: 3000,
        stopOnLastSlide: false,
        disableOnInteraction: false,
    },
    pagination: {
        el: '.pagination',
        type: 'fraction',
    },
});

 

 

Swiper4.x使用方法

 

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!