为什么这个.animate
函数的回调发生在动画之前?
参考:http: //jsfiddle.net/93Qyq/7/
这是 Javascript 部分:
$('#clickButton').click(function() {
$('.spanClass').animate({
left: '+=200'
}, 500, positionReset());
});
function positionReset(){
alert('complete!');
$('.spanClass').animate({'left':'-=200'})
}
这是 HTML:
<div class="divClass">
<span id="a" class="spanClass">A</span>
<span id="b" class="spanClass">B</span>
<span id="c" class="spanClass">C</span>
</div>
<br>
<div id="clickButton">CLICK BUTTON</div><br>
</p>