调用destroy()时,jqueryui对话框未隐藏

即使在对话框被销毁后,显示div元素的jqueryui对话框也存在问题。

我正在使用最新的jqueryui版本1.12.1和当前版本的jquery,版本为3.4.1

这是我初始化对话框的方式:

$("#modal_confirm_yes_no").dialog({
            title: xtitle,bgiframe: true,autoOpen: false,height: xheight,width: xwidth,modal: true,resizable: false,stack: true,//Puts in front of other dialog's that may be open
            buttons: dialog_buttons,open: function(event,ui) {
              $(this).closest('.ui-dialog').find('.ui-dialog-titlebar-close').hide();
            },close: function(event,ui) { $("#modal_confirm_yes_no").hide(); },destroy: function()
            {
                $("#modal_confirm_yes_no").hide();
            }
        });

$("#modal_confirm_yes_no").dialog("open");

以下是显示的对话框的示例:

Screen shot of when the dialog is displayed

当用户按下“否​​”按钮时,将执行以下代码:

$(this).dialog('destroy');

接下来发生的是对话框本身消失,但是内容保持可见。这是显示仍在屏幕上的元素的屏幕截图:

screen shot of dialog box contents still visible after destroy() was called

我应该以其他方式隐藏这些元素吗?

如果我在销毁对话框后调用此行$("#modal_confirm_yes_no").hide();,则它确实可以工作...但是有数百行代码需要更新。我希望在初始化对话框时可以将某些内容放入close()或destroy()函数中……但是它不起作用?

任何帮助将不胜感激。谢谢。

zhaiyawei88 回答:调用destroy()时,jqueryui对话框未隐藏

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/3115008.html

大家都在问