亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

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

鏈式運動的回調函數不執行

回調函數不執行是為什么啊

正在回答

2 回答

<html xmlns="http://www.w3.org/1999/xhtml"> ? ?

<head> ? ?

<meta charset="UTF-8"/> ? ?

<meta name="Generator" content="EditPlus?"/> ? ?

<meta name="Author" content=""/> ? ?

<meta name="Keywords" content=""/> ? ?

<meta name="Description" content=""/> ? ?

<title>Document</title> ? ?

<style type="text/css"> ? ?

/* css默認樣式重置 */ ? ?

body,p,h1,h2,h3,ul,li{margin:0;padding:0;font-size:12px;} ? ?

ul{list-style:none;} ? ?

a{text-decoration:none;} ? ?

img{border:none;vertical-align:top;} ? ?

li{width:200px;height:100px;background:yellow;margin-bottom:20px;border:4px solid black;filter:alpha(opacity:30);opacity:0.3;} ? ?

</style> ? ?

<script type="text/javascript"> ? ?

window.onload=function(){ ? ?

var Li=document.getElementById("li1"); ? ?

Li.onmouseover=function(){ ? ?

startMove(Li,"width",400,function(){ ? ?

startMove(Li,"height",200,function(){ ? ?

startMove(Li,"opacity",100);}); ? ?

}); ? ?

} ? ?

Li.onmouseout=function(){ ? ?

startMove(Li,"opacity",30,function(){ ? ?

startMove(Li,"height",100,function(){ ? ?

startMove(Li,"width",200);}); ? ?

}); ? ?

} ? ?

function startMove(obj,att,iTarget,fn){ ? ?

clearInterval(obj.timer); ? ?

obj.timer=setInterval(function(){ ? ?

var icur=0; ? ?

if(att=="opacity"){ ? ?

icur=Math.round(parseFloat(getStyle(obj,att))*100); ? ?

}else{ ? ?

icur=parseInt(getStyle(obj,att)); ? ?

} ? ?

var speed=(iTarget-icur)/8; ? ?

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

if(obj.icur==iTarget){ ? ?

clearInterval(obj.timer); ? ?

fn && fn();//回調函數 ? ?

}else{ ? ?

if(att=="opacity"){ ? ?

obj.style.filter="alpha(opacity:"+(icur+speed)+")"; ? ?

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

}else{ ? ?

obj.style[att]=icur+speed+"px";} ? ?

} ? ?

},30); ? ?

} ? ?

function getStyle(obj, attr){ ? ?

return obj.currentStyle?obj.currentStyle[attr]:getComputedStyle(obj)[attr]; ? ?

} ? ?

} ? ?

</script> ? ?

</head> ? ?

<body> ? ?

<ul> ? ?

<li id="li1"></li> ? ?

</ul> ? ?

</body> ? ?

</html> ? ?


0 回復 有任何疑惑可以回復我~

你在startMove函數里面做過對回調函數的定義么?把代碼貼出來看下

0 回復 有任何疑惑可以回復我~

舉報

0/150
提交
取消

鏈式運動的回調函數不執行

我要回答 關注問題
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號