我复制了一遍函数,但总显示Cannot read property 'left' of underdifined是肿么回事
我复制了一遍函数,但总显示Cannot read property 'left' of underdifined是肿么回事
function ani (off) {
if (off == 0) {
return;
}
animated = true;
var rtime = 300;
var rinteval = 10;
var rspeed = off/(rtime/rinteval);
var left = parseInt(rolist.style.left) + off;
var gos = function (){
if ( (speed > 0 && parseInt(rolist.style.left) < left) || (rspeed < 0 && parseInt(rolist.style.left) > left)) {
rolist.style.left = parseInt(rolist.style.left) + rspeed + 'px';
setTimeout(go, rinteval);
}
else {
rolist.style.left = left + 'px';
if(left>-20){
rolist.style.left = -200 * len + 'px';
}
if(left<(-200 * len)) {
rolist.style.left = '-200px';
}
animated = false;
}
}
gos();
}