轮播中第五张图转第一张图中间有闪过的空白
<body>
<div id="container">
<div id="list" style="left:-1500px">
<img src="5.png" alt="" />
<img src="1.jpg" alt="" />
<img src="2.jpg" alt="" />
<img src="3.png" alt="" />
<img src="4.png" alt="" />
<img src="5.png" alt="" />
<img src="1.png" alt="" />
我的每张图片都在1500px左右,在轮播时只有向右点击按钮时的最后一张图转第一张图会有空白闪过,而第一张图转最后一张却没有问题,点击代码如下:
function qiehuan(shuzi) {
panduan = true;
var newleft = parseInt(list.style.left) + shuzi;
var time = 300;
var jiange = 10;
var cishu = shuzi / (time / jiange);
function go() {
if ((cishu < 0 && parseInt(list.style.left) > newleft) || (cishu > 0 && parseInt(list.style.left) < newleft)) {
list.style.left = parseInt(list.style.left) + cishu + 'px';
setTimeout(go, jiange);
}
else {
panduan = false;
list.style.left = newleft + 'px';
if (newleft > -1500) {
list.style.left = -7500+ 'px';
}
if (newleft < -7585) {
list.style.left = -1500 + 'px';
}
}
}
go();
}
list父容器的代码也如下:
#list {
position: absolute;
width: 10585px;
height: 800px;
z-index: 1;
}
#list img {
float: left;
height: auto;
width: 1500px;
}
就不明白了