0;
}
var _end = (originX - _width);
inner.style.cssText = "transform: translateX(" + _end + "px);transition:all .3s";
_index++;
if (_index != -1 && _index != imgLength) {
document.querySelectorAll("#"+id+" .num>li")[_index].classList.add("select");
}else if(_index == -1 ){
document.querySelectorAll("#"+id+" .num>li")[imgLength - 1].classList.add("select");
} else if (_index == imgLength) {
play(imgLength);
document.querySelectorAll("#"+id+" .num>li")[0].classList.add("select");
}
}
// 初始化轮播
var autoPlay = setInterval(lunbo,time); //开启轮播
var _Broadcast = new Broadcast(); //实例触摸
这个就是开启个定时器,过固定的时间偏移inner的X,并根据是第几个来判断是否要执行play函数。
https://github.com/Zhoujiando... 源码在这里面,大家可以看一下。
以上就是移动端轮播图实现方法(附源码)的详细内容,更多请关注php中文网其它相关文章!
网站建设是一个广义的术语,涵盖了许多不同的技能和学科中所使用的生产和维护的网站。
关键词:移动端轮播图完成办法(附源码)