jQuery中的animate函数算异步执行吗?

 var mark2=true;

if(mark2){
               move(1);
               mark2=false;

 function move(){
                    $(".box").animate({
                     width: arrW[index],
                      height: arrH[index],
                     opacity: arrO[index],
                     left: arrL[index],
                     top: arrT[index]

                    },500,function(){
                     mark2=true;
                    })


}

以上代码执行   move(1); mark2=false;这两句的时候,move函数中用了animate动画函数,那move的调用是属于异步的吗?也就是放到任务队列中执行吗,所以首先执行mark2=false;这样理解对吗?


慕粉3568301
浏览 1611回答 1
1回答

李晓健

是这样的,你后面的mark2=true;  是动画的回调,它会在动画执行完成以后才执行,你的动画执行时间是500毫秒,所以回调也会在500毫秒以后才执行。如果你的问题已解决,请记得采纳答案!

慕瓜9220888

UPLEDNEOYMBTSDXOVLQONWLVMMXBWSRJDAJTDWCFXYFVWBQCVDUUIIZOUMFWVLCEWPYXOUVVSZHZRYJMVZEGEGJCMSDLDPXNQZCODBTCFYOESONLTMPZCRSRMHUZSIFMRDEBOKKKLJLEQUTGWXGBTJHHDPHTZCJWMXZHZKKXNXAHODVKHAAGUMKMEBKXTJABAPSSOHVEMYJTMFBWEETLOXAAFQVGIOVGZWGZEGPMEHYDSDCPFBBBCUMYUUKUWDDLBOIJJSALQCVLOUTFKWRUBAAIJYTSLYJMBQCDPWZMGAENMFSFWXFQZOLCCZQQIRBABLFPFDPYBYVISFJCVELVLMQOFENAHIFFUZIHLBYZHZOHCTKFFPTCFOEBYZHPBATAXNUJBRTJJGPPQLOWURIFZOZSBKKLSMUIENGNAYIWBNGFARHYLNQQQWDKBRGSRGXOVVIMCVXXELMHWFNWZMFWKVHTIBQTSUFHJYJSPYPMPMEKHHXVSUTUXNADJKWIRDDGAIMRWWJJIPJRCLBBONGNBJLZORHKSTVKFZILVTRZRTGPPSZQPNPPVFEYZRGOBKXPMJFAMIOVOZDJETGPCCNEGFBKXQTYDSTSFVELNEQSKKTGZQBTIANGGJRVUEZFCMPSKIAPTCLFWXAPXOUKSNBGCUDAJVMWLNMLVOKUCDVNXGDPVMO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