zoukankan      html  css  js  c++  java
  • 遍历实例化swiper


    var list = $('.p04-s2 li');
    list.each(function (index) {
    new Swiper ($(this).find('.swiper-container'), {
    spaceBetween: 10,
    slidesPerView : 3,
    watchOverflow: true,
    centeredSlides : true,
    loop: true,
    breakpoints: {
    1500: {
    slidesPerView: 2
    },
    1200: {
    slidesPerView: 1
    }
    },
    pagination: {
    el: $(this).find('.swiper-pagination'),
    clickable :true
    },
    navigation: {
    prevEl: $(this).find('.prev-btn'),
    nextEl: $(this).find('.next-btn'),
    }
    });
    });

    如果是tab下遍历swiper

     
            function initSwiper($element) {
                new Swiper ($element.find('.swiper-container'), {
                    spaceBetween: 20,
                    slidesPerView : s1PerNum,
                    watchOverflow: true,
                    loopedSlides: 5,
                    loop: isLoop($element.find('.swiper-slide'), s1PerNum),
                    breakpoints: { 
                        1366: {
                            slidesPerView: 3
                        },
                        960: {
                            slidesPerView: 2
                        },
                        540: {
                            slidesPerView: 1
                        }
                    },
                    navigation: {
                        prevEl: $element.find('.prev'),
                        nextEl: $element.find('.next')
                    }
                }); 
            }
     
            $('.tab li').click(function() {
                $('.tab li').removeClass('current');
                $(this).addClass('current');
                var clickIndex = $(this).index();
                $currentLI = $('.text-slider > li').removeClass('active').eq(clickIndex).addClass('active');
                if (!$currentLI.data('initState')) {
                    initSwiper($currentLI);
                    $currentLI.data('initState', true);
                }
            }).eq(0).trigger('click'); 
  • 相关阅读:
    Java NIO -- 通道 Channel
    【RF库Collections测试】Convert To List
    【RF库Collections测试】Create Dictionary
    【RF库Collections测试】combine lists
    【RF库Collections库测试】关键字append to list
    【RF库测试】关键字get time
    【RF库测试】DateTime库
    linux 统计命令执行后的行数或者统计目录下文件数目
    grep 同时满足多个关键字和满足任意关键字
    【python】一次执行多个linux命令
  • 原文地址:https://www.cnblogs.com/gduf/p/12021039.html
Copyright © 2011-2022 走看看