如何附加回调到jquery效果对话框显示? [英] How to attach callback to jquery effect on dialog show?

查看:179
本文介绍了如何附加回调到jquery效果对话框显示?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的问题是,我不知道如何附加回调到jquery ui对话框显示。

My problem is that I do not know how to attach callback to the jquery ui dialog show.

show实际上是一个选项:

The show is actually an option:

$( ".selector" ).dialog({ show: 'slide' });

我想在幻灯片动画完成后有回调。我从效果本身看,他们有回调:

I want to have a callback after the slide animation is complete. I looked from the effects itself and they have a callback:

effect( effect, [options], [speed], [callback] )

但在对话框中效果设置非常不同。我也尝试了:

But in the dialog the effect is set up very differently. I tried also putting:

$( ".selector" ).dialog({ show: 'slide', callback: function() {} });

但它不起作用。

建议?

推荐答案

更新2015-07-27 对于使用jQuery v1.10.0或更高版本请参阅此其他答案,因为我的解决方案不适用于较新版本的jQuery。

Update 2015-07-27 For anyone using jQuery v1.10.0 or above please see this other answer as my solution will not work with newer versions of jQuery.

原始答案

已回答,我将要张贴它反正…

Already answered but since I had an answer, I'm going to post it anyway…

$('#dialog').dialog({
    show: {
        effect: 'slide',
        complete: function() {
            console.log('animation complete');
        }
    },
    open: function(event, ui) {
        console.log('open');
    }
});

显示打开,后跟<$ c $在控制台

Shows open followed by animation complete in the Console

这篇关于如何附加回调到jquery效果对话框显示?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆