h5使用swiper示例

    <script src="/public/static/index/assets/js/Swiper-4.0.7/swiper.min.js"></script>
 <script>
        $(function () {
            FastClick.attach(document.body);
            var mySwiper = new Swiper('.swiper-container', {
                direction: 'horizontal',
                loop: true,
                autoplay: true,
                // // 如果需要分页器
                pagination: '.swiper-pagination',
                paginationClickable: true,
                paginationType: 'customs',
                autoplayDisableOnInteraction: false,
                pagination: {
                    el: '.swiper-pagination',
                },

            })
        });
    </script>

  <style>
     .swiper-container {
            width: 95%;
            height: 7rem;
            color: #fff;
            border-radius: .4rem;
        }

        .swiper-container img {
            width: 100%;
            height: 7rem;
        }

        /*包裹自定义分页器的div的位置等CSS样式*/
        .swiper-pagination-bullet {
            bottom: 5%;
            left: 0;
            width: 100%;
            height: 20px;
            /* background-color: red; */
            text-align: center;
        }

        /*自定义分页器的样式,这个你自己想要什么样子自己写*/
        .swiper-pagination-bullet {
            width: 12px;
            height: 4px;
            display: inline-block;
            background: #fff;
            opacity: .3;
            border-radius: 30%;
            margin: 0 5px;
            outline: 0;
        }

        /*自定义分页器激活时的样式表现*/
        .swiper-pagination-bullet-active {
            opacity: 1;
            /* border: 3px solid #f79131; */
            background-color: #5DD1B9 !important;
        }
    </style>
 <div class="swiper-container">
        <div class="swiper-wrapper">
            {volist name='config' id='vo'}
            <div class="swiper-slide">
                <img src="{$vo.image}" alt="">
            </div>
            {/volist}

        </div>
        <!-- 如果需要分页器 -->
        <div class="swiper-pagination"></div>
    </div>

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值