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

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

在學習完美運動框架課程后,這個代碼為什么沒有執行后調函數。

在學習完美運動框架課程后,這個代碼為什么沒有執行后調函數。

手刃情人 2016-04-20 15:33:00
function?startMove(obj,json,func){ ????clearInterval(obj.timer); ????var?i?=?true;//假設所有運動都完成 ????obj.timer?=?setInterval(function(){ ????????//1.取值 ????????for(var?arrt?in?json){ ????????var?ice?=?0; ????????//判斷是否是透明度 ????????if(arrt?==?'opacity'){ ????????????ice?=?Math.round(parseFloat(getStyle(obj,arrt))*100);//當前透明度數值 ????????????}else{ ????????????ice?=?parseInt(getStyle(obj,arrt));//當前數值 ????????????????} ????????//2.計算速度???????? ????????var?speed?=?(json[arrt]-ice)/5; ????????//做緩沖運動的值的取整,如果大于0,向上取整;小于0,向下取整。 ????????speed?=?(speed>0)?Math.ceil(speed):Math.floor(speed); ????????//3.檢查停止 ????????if(ice?!=?json[arrt]){???????????????????????????????? ????????????i?=?false;//假如當前值不等于目標值,繼續執行以下操作。 ????????????????}???????????????????????????????? ??????????????if(arrt?==?'opacity'){ ??????????????????//針對IE瀏覽器 ??????????????????obj.style.filter?=?'alpha(opacity:'+(ice+speed)+')'; ??????????????????//針對FireFox(火狐瀏覽器)/Chrom(谷歌瀏覽器) ??????????????????obj.style.opacity?=?(ice+speed)/100;? ??????????????????}else{ ??????????????????obj.style[arrt]?=?ice?+?speed?+?'px';?? ??????????????????????}???????????????? ????????????} ????????if(i){//假如i成立(等于true),關閉計時器 ????????????clearInterval(obj.timer); ????????????if(func){//判斷是否還有后調函數???? ????????????????func(); ????????????}???????????????? ??????????} ????????},30); ????} ???? ???? <script?type="text/javascript"> window.onload?=?function(){ ????var?div?=?document.getElementById('id'); ???? ????div.onmouseover?=?function(){ ????????startMove(div,{width:400,height:300},function(){ ????????????startMove(div,{opacity:100}); ????????????}); ????????} ????div.onmouseout?=?function(){ ????????startMove(div,{width:200,height:150},function(){ ????????????startMove(div,{opacity:30}); ????????????}); ????????} ????} </script>
查看完整描述

1 回答

  • 1 回答
  • 0 關注
  • 1087 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

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

幫助反饋 APP下載

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

公眾號

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