I use swiper.js to realize automatic rotation. Now there is a need to obtain the time interval between the pictures displayed in this rotation and those displayed in the last rotation, which can be used to bury the sites and monitor whether the rotation images are displayed correctly. How to implement the changes?
var swiper = new Swiper(".swiper-container", {
observer: true,
observeParents: true,
speed: 600,
parallax: true,
loop : true,
loopedSlides: opt&&opt.loopedSlides||2,//loop,loop
centeredSlides : true,//trueactive slide
direction : opt&&opt.direction||"horizontal",
autoplay: {
delay: 1000
},
slidesPerView : opt.slidesPerView||3,
spaceBetween : 10,
on:{
slideChangeTransitionStart: function () {
this.autoplay.stop();
},
slideChangeTransitionEnd: function () {
this.autoplay.start();
},
init: function(){
cb&&cb();
},
slideChange: function(){
}
there is a small problem. I output the current activeIndex under the slideChange function. The first time it always starts at 2. I set the default to start at 0. If I set the default to start at 1, the first time starts at 3.