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

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

請大神看看為什么鼠標(biāo)移出總是不停抖動

<!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" />

<title>無標(biāo)題文檔</title>

<style type="text/css">

*{

margin:0;

padding:0;

}

#box{

position:relative;

left:-200px;

}

.one{

width:200px;

height:200px;

background-color:red;

float:left;

}

.two{

width:50px;

height:50px;

background-color:blue;

float:left;

margin-top:55px;

}

</style>

<script type="text/javascript">

window.onload=function(){

var odiv=document.getElementById("box");

odiv.onmouseover=function(){

starmove1(0)

}

odiv.onmouseout=function(){

? ?starmove1(-200)

}

}




function starmove1(iTarget){

var timer;

clearInterval(timer);

var odiv=document.getElementById("box");

timer=setInterval(function(){

var speed;

if(odiv.offsetLeft>iTarget){

speed=-10;

}else{

speed=10

}

if(odiv.offsetLeft==iTarget){

clearInterval(timer);

}else{

odiv.style.left=odiv.offsetLeft+speed+"px";}

},30);

}


</script>

</head>


<body>

<div id="box">

<div class="one"></div>

<div class="two">分享</div>

</div>

</body>

</html>


正在回答

5 回答

我也是這個問題不知道怎么回事,onmouseout就一直出現(xiàn)抖動問題,請問你知道怎么回事了么,求指教


0 回復(fù) 有任何疑惑可以回復(fù)我~

也許是你沒有給timer和speed初始值吧

0 回復(fù) 有任何疑惑可以回復(fù)我~

我也是這個原因啊 不知道為什么會這樣,照理來說直接在函數(shù)中定義應(yīng)該沒問題啊

0 回復(fù) 有任何疑惑可以回復(fù)我~

猜測是html結(jié)構(gòu)的原因

0 回復(fù) 有任何疑惑可以回復(fù)我~
#1

panmc2

把var timer=null;這句代碼放在執(zhí)行函數(shù)外面就不會出現(xiàn)抖動了。
2016-06-19 回復(fù) 有任何疑惑可以回復(fù)我~

總感覺你設(shè)置的那個speed有問題、而且定時器的調(diào)用成立重復(fù)性。。。。我也不確定是不是這樣的

0 回復(fù) 有任何疑惑可以回復(fù)我~

舉報

0/150
提交
取消

請大神看看為什么鼠標(biāo)移出總是不停抖動

我要回答 關(guān)注問題
微信客服

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

幫助反饋 APP下載

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

公眾號

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