setTimeout(function?(){
var?currentLen?=?parseInt(num.style.marginLeft,10);
if(currentLen?==?len){
resolve();
}
else{
if(currentLen?<len){
currentLen++;
}
else{
currentLen--;
}
}
num.style.marginLeft?=?currentLen?+'px';
__animate();
},10)如題,為什么要寫在里面,寫在else外,只要當前marginleft值不等于要求的長度,寫在外面不也是會執行的么,只是先后順序不同,但是實際小球只動了3次,很不理解為什么會這樣。
為什么_animate()以及賦值marginLeft要寫在else里面
Conqueror1st
2017-03-02 18:34:14