search

Home  >  Q&A  >  body text

html5 - Two swipers are initialized in one page. I don’t know what’s wrong. It’s always wrong.

  var mySwiper1 = new Swiper('.swiper1 .swiper-container', {
        direction: 'horizontal',
        resistanceRatio: 0,
        prevButton: '.swiper-button-prev',
        nextButton: '.swiper-button-next',
        a11y: true,
        initialSlide: initSceneIndex,
        // autoplay:4000,
        // autoplayStopOnLast : true,
        onInit: function (swiper) { //Swiper2.x的初始化是onFirstInit
            swiperAnimateCache(swiper); //隐藏动画元素
            swiperAnimate(swiper); //初始化完成开始动画
        },
        onSlideChangeEnd: function (swiper) {
            swiperAnimate(swiper); //每个slide切换结束时也运行当前slide动画
        }
    });

    var mySwiper2 = new Swiper('.swiper2 .swiper-container', {
        direction: 'vertical',
        resistanceRatio: 0,
        a11y: true,
        // autoplay:4000,
        // autoplayStopOnLast : true,
        onInit: function (swiper) { //Swiper2.x的初始化是onFirstInit
            swiperAnimateCache(swiper); //隐藏动画元素
            swiperAnimate(swiper); //初始化完成开始动画
        },
        onSlideChangeEnd: function (swiper) {
            swiperAnimate(swiper); //每个slide切换结束时也运行当前slide动画
        }
    });
世界只因有你世界只因有你2714 days ago963

reply all(1)I'll reply

  • 扔个三星炸死你

    扔个三星炸死你2017-06-27 09:21:50

    I’m too confused ><

    reply
    0
  • Cancelreply