0

如何在动画后获得对象的正确位置以便进一步工作?

我试过了:

$map.animate({top: t}, 200, alert($map.position().top+':'+t));

这给了我“旧职位:新职位”。

4

1 回答 1

0

您可以使用这样的回调函数:

$('#test').animate({top: '+=200px'}, 200, function() {
    alert($(this).position().top);
});​

试试看:http: //jsfiddle.net/FEwjq/

于 2012-11-28T13:57:56.147 回答