我復制了一遍函數,但總顯示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();
??????????? }
2016-10-26
看你的圖片列表樣式中有沒有設置定位,有沒有left屬性