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

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

js運(yùn)動(dòng) 為什么返回的時(shí)候老是抖動(dòng)?

js運(yùn)動(dòng) 為什么返回的時(shí)候老是抖動(dòng)?

慕粉4084340 2016-10-12 09:33:33
<!doctype html><html><head><meta charset="UTF-8"><title>speed</title><style type="text/css">div{width: 100px;height: 50px;background: red;margin: 10px}</style><script type="text/javascript">window.onload=function(){var aDiv=document.getElementsByTagName('div')for(var i=0;i<aDiv.length;i++){ ? ? ? ? ? aDiv[i].timer=nullaDiv[i].onmouseover=function(){startMove(this,400)}aDiv[i].onmouseout=function(){startMove(this,100)}}}var timer=null;function startMove(obj,iTarget){clearInterval(timer)obj.timer=setInterval(function(){? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? var speed=(iTarget-obj.offsetWidth)/6;? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? speed=speed>0?Math.ceil(speed):Math.floor(speed)? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? if(obj.offsetWitdh==iTarget)? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? {? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?clearInterval(obj.timer)? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? }? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? else? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? {? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?obj.style.width=obj.offsetWidth+speed+'px'? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? }},30)}</script></head><body><div></div><div></div><div></div></body></html>
查看完整描述

1 回答

已采納
?
stone310

TA貢獻(xiàn)361條經(jīng)驗(yàn) 獲得超191個(gè)贊

最開始的也要改成clearInterval(obj.timer);

還有if(obj.offsetWitdh==iTarget)這里width寫錯(cuò)了

? ? ? ? ? ? ? ? ? ? ? ? ? ? ?

查看完整回答
反對(duì) 回復(fù) 2016-10-12
  • 1 回答
  • 1 關(guān)注
  • 1535 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

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

幫助反饋 APP下載

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

公眾號(hào)

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