淡入淡出轮播
var oBox = document.getElementById("box");
var pic = document.querySelectorAll("#box>img");
var timer = null;
var iNow = 0;
var n = 0;
setInterval(function () {
if (iNow == pic.length - 1) {
iNow = 0;
} else {
iNow++;
}
toImg();
}, 3000)
function toImg() {
move(pic[n], { opacity: 0 });
move(pic[iNow], { opacity: 100 });
n = iNow;
}
SRE实战 互联网时代守护先锋,助力企业售后服务体系运筹帷幄!一键直达领取阿里云限量特价优惠。
思路:n始终跟随iNow,iNow当跳转为length-1的时候,变为0

更多精彩