首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >对2行jQuery进行测序

对2行jQuery进行测序
EN

Stack Overflow用户
提问于 2010-05-24 12:36:13
回答 1查看 235关注 0票数 1

我有以下几行jQuery代码:

代码语言:javascript
复制
// 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,我如何对这两行进行排序,使其在第一行完成之前不继续进行?

EN

回答 1

Stack Overflow用户

发布于 2010-05-24 13:13:34

另一种等待动画结束的方法是使用它的回调:

代码语言:javascript
复制
stop: function(event, ui) {
     $placeholder.after( $(this).show('fast', 
                           function() { // called when show is done
                              $placeholder.remove(); // var still accessable
                              settings.stop.apply(this);
                            });
                       );
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/2894748

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档