获取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

浙公网安备 33010602011771号