swiper 双排切换分组_编程笔记

swiper 双排切换分组

2023-01-17 11:06:37  浏览:796  作者:保利尼奥
<div class="proSwiper swiper-cp1"> <div class="swiper-wrapper"> {% for value in products.show(0,6,0,1) %} <div...
<div class="proSwiper swiper-cp1">
    <div class="swiper-wrapper">
        {% for value in products.show(0,6,0,1) %}
        <div class="slicon">
            <a href="{{ value.url }}" title="{{ value.title }}">
              <div class="img com-img">
                 <img src="{{ app('content').thumb(value.uploadfiles[0],600,600) }}" alt="">
              </div>
            </a>
        </div>
        {% endfor %}
    </div>
</div>

<script>
    /* 使用js分组,每4个.slick-con放到一个div里面 */
    jQuery(".swiper-cp1 .slicon").each(function(i){ jQuery(".swiper-cp1 .slicon").slice(i*2,i*2+2).wrapAll("<div class='swiper-slide'></div>");});

    var swiper = new Swiper(".swiper-cp1", {
        slidesPerView: 3,
        spaceBetween: 30,
        autoplay:true,
        loop: true,
    });
</script>


评论区

共 0 条评论
  • 这篇文章还没有收到评论,赶紧来抢沙发吧~

【随机内容】

返回顶部