swiper 鼠标移入切换_编程笔记

swiper 鼠标移入切换

2023-06-12 08:29:01  浏览:1332  作者:保利尼奥
swiper鼠标移入切换
<div class="pro_section">
    <div class="pin_swiper">
        <div class="swiper-wrapper">
            {% for value in app('section').id('67303') %}
            <div class="swiper-slide">
               <img src="{{ value.img[0] }}" alt="{{ value.name }}">
            </div>
            {% endfor %}
        </div>
    </div>
   
    <div class="pin_swiper2">
        <div class="swiper-wrapper">
            {% for value in app('section').id('67303') %}
            <div class="swiper-slide">{{ value.name }}</div>
            {% endfor %}
        </div>
    </div>
</div>

<script>
    var swiper = new Swiper(".pin_swiper2", {
        slidesPerView: 5,
        freeMode: true,
        watchSlidesProgress: true,
        breakpoints: {
            640: {
                slidesPerView: 2,
                spaceBetween: 0,
            },
            768: {
                slidesPerView: 3,
                spaceBetween: 0,
            },
            1024: {
                slidesPerView: 4,
                spaceBetween: 0,
            },
        },

    });

    var swiper2 = new Swiper(".pin_swiper", {
        spaceBetween: 0,
        speed:800,
        thumbs: {
            swiper: swiper,
        },
    });

    $(".pin_swiper2 .swiper-slide").on("mouseenter", function() {
        var slideIndex = $(this).index();
        swiper2.slideTo(slideIndex, 800, false);
    });

</script>


上一篇:swiper 分组切换

下一篇:swiper 3D切换

评论区

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

【随机内容】

返回顶部