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

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

為什么我在學(xué)習(xí) promise的時候 第二個小球就不會動了

為什么我在學(xué)習(xí) promise的時候 第二個小球就不會動了

qq_畫晚_0 2017-11-02 16:58:36
代碼如下,只有第一個小球會動,然后就沒然后了~~<script?type="text/javascript"> ??var?ball1?=?document.querySelector('.ball1'); ??var?ball2?=?document.querySelector('.ball2'); ??var?ball3?=?document.querySelector('.ball3'); ??var?Promise?=?window.Promise; ??function?p_animate(ball,distance){ ????return?new?Promise(function(resolve,reject){ ??????function?_animate(){ ????????setTimeout(function(){ ??????????var?marginLeft?=?ball.style.marginLeft==''?0:parseInt(ball.style.marginLeft); ??????????if?(marginLeft?==?distance)?{ ????????????resolve; ??????????}else{ ????????????if?(marginLeft<distance)?{ ??????????????marginLeft++; ????????????}else{ ??????????????marginLeft--; ????????????}; ????????????ball.style.marginLeft?=?marginLeft+'px'; ??????????} ??????????_animate(); ????????},13); ??????} ??????_animate() ????}) ??} ??p_animate(ball1,100) ????.then(function(){ ??????return?p_animate(ball2,200) ????}) ????.then(function(){ ??????return?p_animate(ball3,300) ????}) ????.then(function(){ ??????return?p_animate(ball3,150) ????}) ????.then(function(){ ??????return?p_animate(ball2,150) ????}) ????.then(function(){ ??????return?p_animate(ball1,150) ????}) </script>
查看完整描述

1 回答

?
牛奶老哥哥

TA貢獻204條經(jīng)驗 獲得超92個贊

resolve 是函數(shù)需要執(zhí)行啊?

resolve();


查看完整回答
1 反對 回復(fù) 2017-11-02
  • 1 回答
  • 0 關(guān)注
  • 1265 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

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

幫助反饋 APP下載

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

公眾號

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