第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

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

方塊來回抽動,求解答

<div?class="hide"?id="hide"><div?class="hover"?id="hover"></div></div>
<style>
??*?{margin:?0;?padding:?0;?}
??.hide?{height:?500px;?width:?500px;?background-color:?red;?position:?absolute;?left:?-500px;?}
??.hover?{height:?50px;?width:?50px;?background-color:?blue;?position:?relative;?top:?225px;?left:?500px;?}
</style>

<script>
??var?hide=document.getElementById('hide');
??var?hover=document.getElementById('hover');
??var?timer=null;
??var?startMove=function()?{
????clearInterval(timer);
????timer=setInterval(function(){
??????????????if(hide.offsetLeft<0){
????????????????hide.style.left=hide.offsetLeft+10+'px'
??????????????}else{
????????????????clearInterval(timer)
??????????????}},30
????)
??};

??var?endMove=function()?{
????timer=setInterval(function(){
??????????????if(hide.offsetLeft>-500){
????????????????hide.style.left=hide.offsetLeft-10+'px'
??????????????}else{
????????????????clearInterval(timer)
??????????????}},30
????)
??};

??hover.onmouseover=function()?{
????startMove();
??};

??hover.onmouseout=function()?{
????endMove();
??};

</script>


正在回答

3 回答

hide.offsetLeft<0,hide.offsetLeft>-500


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

懶人一只 提問者

是兩個動作的if條件嗎,我就是這么寫的,按照你給的綁定到hide上發(fā)現(xiàn)出來沒有問題了,就是還是回不去。
2016-03-14 回復(fù) 有任何疑惑可以回復(fù)我~
#2

懶人一只 提問者

真的非常感謝大神
2016-03-14 回復(fù) 有任何疑惑可以回復(fù)我~
#3

懶人一只 提問者

已經(jīng)解決了,用事件冒泡的思想
2016-03-14 回復(fù) 有任何疑惑可以回復(fù)我~

onmouseover和onmouseout綁定在hide元素上

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

hide.offsetLeft>-500

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

舉報(bào)

0/150
提交
取消
JS動畫效果
  • 參與學(xué)習(xí)       113920    人
  • 解答問題       1489    個

通過本課程JS動畫的學(xué)習(xí),從簡單動畫開始,逐步深入各種動畫框架封裝

進(jìn)入課程

方塊來回抽動,求解答

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

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

幫助反饋 APP下載

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

公眾號

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