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

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

為什么鼠標移開的時候不能回移?

為什么鼠標移開的時候不能回移?

qq_吃藥先森_03169839 2016-05-06 15:26:26
<!DOCTYPE?html?PUBLIC?"-//W3C//DTD?XHTML?1.0?Transitional//EN"?"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html?xmlns="http://www.w3.org/1999/xhtml"> <head> <meta?http-equiv="Content-Type"?content="text/html;?charset=utf-8"?/> <style?type="text/css"> all{?margin:0;?padding:0;} div{?background-color:red;?width:200px;?height:300px;?left:-200px;?position:relative;} span{?background-color:blue;width:20px;?height:40px;?position:absolute;left:200px;?color:#FFF;?top:75px;} </style> <script> window.onload=function(){ ????var?timer=null, ????????a=document.getElementById('a'); ???? ????a.onmouseover=function(){ ????????Move(0); ????} ????a.onmouseout=function(){ ????????Move(-200); ????????} ????function?Move(num){ ????????clearInterval(timer); ????????a=document.getElementById('a'); ????????if(a.offsetLeft<num){ ????????timer=setInterval(function(){ ????????????if(a.offsetLeft?>=?num) ????????????{ ????????????????clearInterval(timer); ???????????? ????????????} ????????????else{ ????????????????a.style.left=a.offsetLeft+?1?+'px'; ????????????????} ????????????},30); ????????} ????????else?if(a.offsetLeft>num){ ????????????timer=setInterval(function(){ ????????????if(a.offsetLeft?==?num) ????????????{ ????????????????clearInterval(timer); ???????????? ????????????} ????????????else{ ????????????????a.style.left=a.offsetLeft-?1?+'px'; ????????????????} ????????????},30);} ????} } </script> <title>無標題文檔</title> </head> <div?id="a"><span?id="box">分享</span></div> <body> </body> </html>
查看完整描述

1 回答

?
qq_青棗工作室_0

TA貢獻446條經驗 獲得超754個贊

div{?background-color:red;?width:200px;?height:300px;?left:-200px;?position:relative;}

這里的?position:relative 要改為?position:absolute;

查看完整回答
2 反對 回復 2016-05-06
  • 1 回答
  • 0 關注
  • 1334 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

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

幫助反饋 APP下載

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

公眾號

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