第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機(jī)立即綁定

錯誤提示Cannot read property 'timer' of undefined求解

function startMove(obj,json,fn){

clearInterval(obj.timer);

obj.timer= setInterval(function(){

var flag=true;

for(var attr in json){

//取當(dāng)前屬性的值

var cur= 0;

if(attr=='opacity'){

cur= Math.round(parseFloat(getStyle(obj,attr)*100)); //能讓范圍回到0~100

}

else{

cur = parseInt(getStyle(obj,attr));

}

//定義速度

var speed = (json[attr] - cur)/ 8 ;

// 取整速度

speed= speed >0?Math.ceil(speed):Math.floor(speed);

//立flag

if(cur!=json[attr]){

flag=false;

if(attr== 'opacity'){

//firefox瀏覽器

obj.style.opacity = (cur + speed)/100;

//IE瀏覽器?

obj.style.filter ?= 'alpha:(opacity:'+(cur+speed)+')';

}

else{

obj.style[attr] ? = cur + speed +'px';

}

}

if(flag){

clearInterval(obj.timer);

if(fn){

fn();

}

}

}

},30)


}

function getStyle(obj,attr){

if(obj.currentStyle){

return obj.currentStyle[attr];

}

else{

return getComputedStyle(obj,false)[attr];

}

}

錯誤位置js代碼第二行。這個框架在上一節(jié)里都沒有問題。

正在回答

1 回答

我的可以正常運行。我的是 Dreamweaver CC 2015.02 Release 7884 Build 。你可以嘗試一下在 .html 頁面的 for 循環(huán)中為每個 obj 設(shè)置一下 timer 。像下邊這樣:

for(var?i?=?0;?i?<?app.length;?i++)??//var?app=document.getElementsByTagName('a');
{
????app[i].timer?=?null;
????...
}


0 回復(fù) 有任何疑惑可以回復(fù)我~

舉報

0/150
提交
取消

錯誤提示Cannot read property 'timer' of undefined求解

我要回答 關(guān)注問題
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號