最近中文字幕高清中文字幕无,亚洲欧美高清一区二区三区,一本色道无码道dvd在线观看 ,一个人看的www免费高清中文字幕

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

關(guān)于js制作側(cè)拉動畫的問題

關(guān)于js制作側(cè)拉動畫的問題

MR158 2016-02-03 18:12:54
<!DOCTYPE?html> <html> <head> <title></title> <style?type="text/css"> *{ margin:0; padding:0; } #sdiv{ width:?200px; height:200px; background-color:skyblue; float:left; } #div{ width:?300px; height:200; position:relative; left:?-200px; } #span{ float:left; font-size:?20px; background:?#456; margin-top:?80px; line-height:?18px; } </style> <script?type="text/javascript"> window.onload=function(){ var?span=document.getElementById("span"); var?div=document.getElementById("div"); var?sdiv=document.getElementById("sdiv"); span.onmouseover=function(){ move(0); } sdiv.onmouseout=function(){ move(-200) } } function?move(target){ var?div=document.getElementById("div"); var?speed=0; clearInterval(timer); var?timer=setInterval(function(){ if?(div.offsetLeft==target)?{ clearInterval(timer) }else?if(div.offsetLeft<target){ speed?=?10; div.style.left=div.offsetLeft+speed+"px"; }else?if(div.offsetLeft>target){ speed?=?-10; div.style.left=div.offsetLeft+speed+"px" }; },30) } </script> </head> <body> <div?id="div"> <div?id="sdiv"></div> <span?id="span">分<br/>享</span> </div> </body> </html>一個onmouseover和onmouseout觸發(fā)的動畫,但在同時觸發(fā)時(比如移開sdiv時同時經(jīng)過span的動畫還在執(zhí)行)會給target輸入兩個值,如何解決這個問題?
查看完整描述

1 回答

  • 1 回答
  • 0 關(guān)注
  • 1421 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

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

幫助反饋 APP下載

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

公眾號

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