JQueryUI dialog hide option prevents close event from firing

怎甘沉沦 提交于 2019-12-11 08:05:02

问题


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 (used for fiddle):

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:


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



来源:https://stackoverflow.com/questions/13458978/jqueryui-dialog-hide-option-prevents-close-event-from-firing

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!