我有以下几行jQuery代码:
// When dragging ends
stop: function(event, ui) {
// Replace the placeholder with the original
$placeholder.after( $this.show() ).remove();
// Run a custom stop function specitifed in the settings
settings.stop.apply(this);
},我不希望settings.stop.apply(this);在上面的代码行($placeholder.after( $this.show() ).remove();)之前运行,现在发生的是settings.stop正在提前运行。
使用jQuery,我如何对这两行进行排序,使其在第一行完成之前不继续进行?
发布于 2010-05-24 13:13:34
另一种等待动画结束的方法是使用它的回调:
stop: function(event, ui) {
$placeholder.after( $(this).show('fast',
function() { // called when show is done
$placeholder.remove(); // var still accessable
settings.stop.apply(this);
});
);https://stackoverflow.com/questions/2894748
复制相似问题