window.onload = function () {
var oPicDiv = document.getElementById("pic"),
oList = document.getElementById("list"),
oPicDiv1 = document.getElementById("pic1"),
oList1 = document.getElementById("list1");
oList1.innerHTML = oList1.innerHTML + oList1.innerHTML;
oList.innerHTML = oList.innerHTML + oList.innerHTML;
var iLeft = 0;
var iPosition = -1;
function fnAnimation() {
iLeft += iPosition;
if (iLeft < -1000) {
iLeft = 0;
}
if (iLeft > 0) {
iLeft = -1000;
}
oList.style.left = iLeft + "px";
oList1.style.left = iLeft + "px";
console.log("定时器一直在走");
}
var timer = setInterval(fnAnimation,35);
oPicDiv.onmouseover = function () {
clearInterval(timer);
}
oPicDiv.onmouseout = function () {
timer = setInterval(fnAnimation,35);
}
oPicDiv1.onmouseover = function () {
clearInterval(timer);
}
oPicDiv1.onmouseout = function () {
timer = setInterval(fnAnimation, 35);
}
}