取消对jQuery UI的对话框插件的关闭按钮的最佳方式? [英] Best way to remove the close button on jQuery UI dialog box widget?

查看:482
本文介绍了取消对jQuery UI的对话框插件的关闭按钮的最佳方式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

什么是去除对jQuery UI的对话框中的关闭按钮的最佳方式?

What's the best way to remove the close button on the jQuery UI dialog box?

我不希望人们能够以关闭对话框。

I do not wish people to be able to close the dialog box.

我通过处理覆盖其上的code角:

I'm covering it on the code angle by handling:

closeOnEscape: false,
beforeclose: function (event, ui) { return false; }

我想没有需要编写脚本来虎视眈眈的关闭按钮的类/ ID,然后手工将其隐藏。我宁愿不更改CSS或者手动,因为对话框可能的情况下,它需要的关闭按钮。

I'm trying not to need to write script to grap the class / id of the close button and then hide it manually. And I'd rather not change the CSS manually either, as the dialog box may have situations where it needs the close button.

我倒是preFER以某种方式做对话框配置,但无论是我无法弄清楚如何做到这一点或对话框不允许它。

I'd prefer to do it the dialog config somehow, but either I can't figure out how to do it or the dialog box doesn't allow for it at all.

如何配置对话框有什么建议?

Any suggestions on how to configure the dialog box?

推荐答案

我发现这是一个很好的解决方案。

I found this to be a good solution

$("#myDialogID").dialog({
    closeOnEscape: false,
    beforeClose: function (event, ui) { return false; },
    dialogClass: "noclose"
});

不改变现有的样式,而不是添加一个新的位:

Not altering the existing styles, instead adding a new bit:

.noclose .ui-dialog-titlebar-close
{
    display:none;
}

添加类结束了相当的巧妙的方法,因为我分级的对话框作为一个不能被关闭。

Adding the class ended up being quite an elegant method, as i'm "classing" the dialog as one that cannot be closed.

这篇关于取消对jQuery UI的对话框插件的关闭按钮的最佳方式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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