这节课的两个问题:1.设定球的边距时,后面要加上“px”---- ball.style.marginLeft = marginLeft+"px";
2.用Promise时,左边距与设定的距离相等时,
if(marginLeft === distance){
resolve();
return;
}
2.用Promise时,左边距与设定的距离相等时,
if(marginLeft === distance){
resolve();
return;
}
2016-11-10
最新回答 / feiger
var ball1 = document.querySelector('.ball1'); var ball2 = document.querySelector('.ball2'); var ball3 = document.querySelector('.ball3'); function animate(ball,distence,cb){ setTimeout(function(){ alert(1) //为什么alert不执行? var marginLeft = parseInt(ba...
2016-11-04