JQueryUI对话框的隐藏选项可防止触发close事件 [英] JQueryUI dialog hide option prevents close event from firing

查看:63
本文介绍了JQueryUI对话框的隐藏选项可防止触发close事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

When using the JQueryUI dialog with the hide option added, the close event never fires. See my fiddle below to repro both ways.
Is there a workaround that I'm not aware of? I tried reordering them, but it didn't work. Any ideas?

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');

推荐答案

您正在使用jQuery UI 1.7.2.如果您将其替换为最新版本(1.9.1-//ajax.googleapis.com/ajax/libs/jqueryui/1.9.1/jquery-ui.min.js),则您的代码将按预期工作.我不知道这些版本之间到底发生了什么变化,但是你去了

You're using jQuery UI 1.7.2 in your fiddle. If you replace it with the latest one (1.9.1 - //ajax.googleapis.com/ajax/libs/jqueryui/1.9.1/jquery-ui.min.js) then your code works as expected. I don't know exactly what changed between those versions but there you go

这篇关于JQueryUI对话框的隐藏选项可防止触发close事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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