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

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定

只移動(dòng)了一次,不會(huì)往回走

http://img1.sycdn.imooc.com//572432910001af2b04920707.jpg

<div?class="red"?style="margin-left:?1px;"></div>
<div?class="blue"?style="margin-left:?1px;"></div>
<div?class="green"?style="margin-left:?1px;"></div>
<script?type="text/javascript">
????var?b1=document.querySelector(".red");
????var?b2=document.querySelector(".blue");
????var?b3=document.querySelector(".green");
????var?Promise=window.Promise;
????console.log(Promise)
????function?promiseMove(ball,distance){
????????return?new?Promise(function(resolve,reject){
????????????function?_move(){
????????????????var?mleft=parseInt(ball.style.marginLeft,10);
????????????????setTimeout(function(){
????????????????????var?mleft=parseInt(ball.style.marginLeft,10);
????????????????????if(mleft===distance){
????????????????????????resolve()
????????????????????}else{
????????????????????mleft<distance?mleft++:mleft--
????????????????????}
????????????????????ball.style.marginLeft=mleft+'px';
????????????????????_move();
????????????????},13)
????????????};
????????????_move();
????????})
????}
????promiseMove(b1,100)
????????.then(function(){
????????????return?promiseMove(b2,200)
????????}).then(function(){
????????????return?promiseMove(b3,300)
????????}).then(function(){
????????????return?promiseMove(b3,150)
????????}).then(function(){
????????????return?promiseMove(b2,150)
????????}).then(function(){
????????????return?promiseMove(b1,150)
????????})
</script>


正在回答

3 回答

騷年,我兩犯了同樣的錯(cuò)誤。

http://img1.sycdn.imooc.com//57262ad3000105f504960495.jpg

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

Marsd 提問者

非常感謝!
2016-05-03 回復(fù) 有任何疑惑可以回復(fù)我~

<!DOCTYPE html>

<html>

<head>

<meta charset="UTF-8">

<title>promise animation</title>

<style>

? ? ? ? ? ? .ball{

? ? ? ? ? ? ?width: 40px;

? ? ? ? ? ? ?height:40px;

? ? ? ? ? ? ?border-radius:20px;

? ? ? ? ? ? }

? ? ? ? ? ? .ball_fi{

? ? ? ? ? ? ?background: red;

? ? ? ? ? ? }

? ? ? ? ? ? .ball_se{

? ? ? ? ? ? ?background: green;

? ? ? ? ? ? }


? ? ? ? ? ? .ball_th{

? ? ? ? ? ? ?background: blue;

? ? ? ? ? ? }

</style>

</head>

<body>

<div class="ball ball_fi" style="margin-left: 0">&nbsp;</div>

<div class="ball ball_se" style="margin-left: 0">&nbsp;</div>

<div class="ball ball_th" style="margin-left: 0">&nbsp;</div>

<script>

var ballfi=document.querySelector(".ball_fi")

var ballse=document.querySelector(".ball_se")

var ballth=document.querySelector(".ball_th")


function animate(balls,distance,cb){

? ? ? ? setTimeout(function(){

? ? ? ? ?var marginLeft= parseInt(balls.style.marginLeft,10)

? ? ? ? ?if(marginLeft===distance){

? ? ? ? ? ?cb && cb()

? ? ? ? ?}else {

? ? ? ? ?if(marginLeft<distance){

? ? ? ? ?marginLeft++

? ? ? ? ?}else{

? ? ? ? ?marginLeft--

? ? ? ? ? }

? ? ? ? ? ? ?balls.style.marginLeft=marginLeft+"px"

? ? ? ? ? ? ?animate(balls,distance,cb)

? ? ? ? ? ??

? ? ? ? ?}

? ? ? ? },10)

? ? }


? ? animate(ballfi,100,function(){

? ? ?animate(ballse,300,function(){

? ? ?animate(ballth,150,function(){

? ? ? ? ? ? ? ? animate(ballth,200,function(){

? ? ? ? ? ? ? ? ?animate(ballse,100,function(){

? ? ? ? ? ? ? ? ?animate(ballth,100,function(){

? ? ? ? ? ? ? ? ?})

? ? ? ? ? ? ? ? ?})

? ? ? ? ? ? ? ? })

? ? ?})

? ? ?})

? ? })


</script>

</body>


</html>


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

看了半天,也沒有發(fā)現(xiàn)問題呀!

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

Marsd 提問者

就是看不出來才問的。。你有負(fù)責(zé)代碼運(yùn)行試試嗎;
2016-05-01 回復(fù) 有任何疑惑可以回復(fù)我~

舉報(bào)

0/150
提交
取消
進(jìn)擊Node.js基礎(chǔ)(二)
  • 參與學(xué)習(xí)       76728    人
  • 解答問題       242    個(gè)

本教程帶你攻破 Nodejs,讓 JavaScript流暢運(yùn)行在服務(wù)器端

進(jìn)入課程

只移動(dòng)了一次,不會(huì)往回走

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

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

幫助反饋 APP下載

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

公眾號(hào)

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