获取swiper的索引

效果:

 

js代码:

swiper.on('slideChangeTransitionEnd', function () {
        var txt = $('.swptest_bot_right').html();
        var snum = swiper.activeIndex+1;
        console.log(snum);
        console.log(swiper.activeIndex+"/10题");
        newml=document.getElementById("snum");
        newml.innerHTML=snum+"/10题";
    });

 

 

 

 

参考文章:https://blog.csdn.net/jensen_yao/article/details/79289592

 

posted @ 2022-03-01 15:04  宅女二二  阅读(415)  评论(0)    收藏  举报