JQueryUI对话框隐藏选项可防止触发关闭事件

时间:2012-11-19 17:25:59

标签: jquery-ui-dialog

使用添加了隐藏选项的JQueryUI对话框时,关闭事件永远不会触发。请看下面的小提琴,重复两种方式。
有没有我不知道的解决方法?我尝试重新排序它们,但它没有用。有什么想法吗?

http://jsfiddle.net/johntrepreneur/f4Ytr/3/

JAVASCRIPT(用于小提琴):

var $dialog = $('<div></div>').html('Using the hide dialog option ' +
        'prevents the close event from firing. Clicking close does ' +
        'nothing. Try commenting out the javascript line with the ' +
        'hide effect to see the alert show up after clicking close.'
    ).dialog({
        close: function () { alert('this will never show if hide option is active'); },
        //hide: { effect: 'drop', direction: 'up' } //comment out to see alert show up
    });
$dialog.dialog('open');

1 个答案:

答案 0 :(得分:2)

你在小提琴中使用jQuery UI 1.7.2。如果用最新的替换它(1.9.1 - //ajax.googleapis.com/ajax/libs/jqueryui/1.9.1/jquery-ui.min.js),那么您的代码将按预期工作。我不确切知道那些版本之间发生了什么变化,但是你去了