$(this).animate({"left": left+"px"}, { queue: false, duration: 500 })
.animate({"top": top+"px"}, { queue: false, duration: 500 })
.animate({"height": size+"px"}, { queue: false, duration: 500 })
.animate({"width": size+"px"}, { queue: false, duration: 500 });
我是 jQuery 的初学者。我希望在动画完成时运行以下代码:
$('#map').css('cursor','pointer');
我怎样才能做到这一点?而且,如果我的代码很糟糕,如果您改进它,我将非常感激。
谢谢!
最佳答案
您可以一次为它们全部设置动画并使用"complete" callback :
$(this).animate({
left: left + 'px',
top: top + 'px',
height: size + 'px',
width: size + 'px'
}, {
queue: false,
duration: 500,
complete: function() {
$('#map').css('cursor','pointer');
}
});
关于jquery - 动画完成时执行代码 jQuery,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7032317/