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

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

這咋回事啊,咋整啊,大佬幫幫忙啊?

這是按照課程敲的代碼,在寬高同時運動時還有用,到例子就不對勁了,走一下停一下function getstyle(obj,attr){ if(obj.currentStyle) { return obj.currentStyle[attr]; } else { return getComputedStyle(obj,false)[attr]; }}var timer=null;function startMove(obj,json,fn){ //fn為回調函數 clearInterval(obj.timer); var flag=true; obj.timer=setInterval(function(){ //取當前值 //var flag=true; for(var attr in json) { var icurr=0;//要獲取的屬性 var speed=0; if(attr=='opacity'){ icurr=Math.round(parseFloat(getstyle(obj,attr))*100); } else{ ? ?icurr=parseInt(getstyle(obj,attr)); } //計算速度 speed=(json[attr]-icurr)/8; speed=speed>0?Math.ceil(speed):Math.floor(speed); //判斷停止 if(icurr!=json[attr]) { ? flag=false; } if(attr=='opacity'){ obj.style.filter='alpha(opacity:'+(icurr+speed)+')';//針對IE obj.style.opacity=(icurr+speed)/100; } else{ obj.style[attr]=icurr+speed+'px'; } } if(flag=true) { clearInterval(obj.timer); if(fn) { fn(); } } },30); }例子部分: <script type="text/javascript" > window.onload=function(){ var oMove=document.getElementById('move'); var alist=oMove.getElementsByTagName('a'); for(var i=0;i<alist.length;i++) { alist[i].onmouseenter=function(){ var _this=this.getElementsByTagName('i')[0];? ? ? ? ?startMove(_this,{top:-25,opacity:0},function(){? ? ? ? ? ?startMove(_this,{top:20,opacity:100})? ? ? ? ? }) ? ? ? } ? } } </script>每次移入向上走一下
查看完整描述

1 回答

?
qq_臨摹不凡_0

TA貢獻7條經驗 獲得超1個贊

解決了


查看完整回答
反對 回復 2017-11-17
  • 1 回答
  • 0 關注
  • 1257 瀏覽
慕課專欄
更多

添加回答

了解更多

舉報

0/150
提交
取消
微信客服

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

幫助反饋 APP下載

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

公眾號

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