简体   繁体   English

如何让jquery-ui-dialog没有关闭按钮?

[英]How to make jquery-ui-dialog not have a close button?

I didn't find this in the documentation . 我没有在文档中找到这个。

Should I just make the close button display:none with css, or is there a clean way in the API to make a dialog without the X button (top-right)? 我应该只display:none关闭按钮display:none css,或者API中是否有一个干净的方式来创建没有X按钮的对话框(右上角)?

This may solve your Problem: 这可以解决您的问题:

       $("#dialogId").dialog({
           closeOnEscape: false,
           open: function(event, ui) { $(".ui-dialog-titlebar-close", ui.dialog).hide(); }
       });

There is no option to disable the 'X' button. 没有选项可以禁用“X”按钮。 You would need to add css to display none/hide() the element with the class 'ui-icon-closethick' when it is loaded and opened. 在加载和打开时,你需要添加css来显示无'/ hide()元素'ui-icon-closethick'。

For some reason .hide() did not work for me. 出于某种原因.hide()对我不起作用。 This did: 这样做:

$('#divMsg').dialog({ title: 'Please wait...',
                      modal: true,
                      closeOnEscape: false,
                      open: function (event, ui) { $(".ui-dialog-titlebar-close", ui.dialog).css('display', 'none'); } }).text('Text To Display').css('background', 'white');

This code snippet also shows how to set the title and text of the dialog box -- I am using it as a modal notification window and closing it when my AJAX call completes. 此代码段还显示了如何设置对话框的标题和文本 - 我将其用作模式通知窗口,并在我的AJAX调用完成时关闭它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM