【问题标题】:jQuery UI dialog remove outer glow and change text of close buttonjQuery UI 对话框移除外发光并更改关闭按钮的文本
【发布时间】:2012-07-11 07:22:39
【问题描述】:

我正在尝试自定义我的 jQuery UI 确认对话框窗口。找不到如何从按钮(悬停时)删除浅蓝色外发光,将关闭文本按钮从“关闭”更改为“x”并删除关闭按钮悬停背景。 某处是否有关于所有对话框类的文档?

这是代码:

function fnComfirm(title, content, btnId) {
    $("#dialog:ui-dialog").dialog("destroy");
    $("#dialog-confirm p").text(content);
    $("#dialog-confirm").dialog({
        title: title,
        resizable: false,
        height: 200,
        width: 486,
        modal: true,
        buttons: {
            "OK": function() {
                $( this ).dialog("close");
                if (btnId) document.getElementById(btnId).click();                  
                return true;        
            },
            Cancel: function() {
                $( this ).dialog("close");
                return false;
            }
        }
    });
    $('body').css('overflow','hidden');
    $("div[role=dialog] button:contains('Cancel')").css("background-image", "none").css("border", "0px solid #FFF");
    $('.ui-dialog :button').blur();     
}

HTML:

<div id="dialog-confirm" title="Are you sure?"><p></p></div>

包括:

<h:outputScript library="js" name="jquery-ui-1.8.min.js" />

【问题讨论】:

  • 视觉元素上的 css 取决于您使用的主题。请添加显示一些代码的链接
  • 我不需要主题,我想应用我的样式。部分完成,只是需要完成一些事情。

标签: jquery jquery-ui jquery-ui-dialog


【解决方案1】:
Div.dialog({
    autoOpen: true,
    closeOnEscape: false,
    closeText: '',
    modal: true,
    draggable: false,
    resizable: false,
    width: 640,
    height: 420,
    close: function(event, ui) {
        if (orderModifyFlag == true) {
            messageDisplay(1000);
        } else {
            messageDisplay(651);
        }
    }
});

【讨论】:

  • 虽然此代码可能会回答问题,但提供有关此代码为何和/或如何回答问题的额外上下文可提高其长期价值。
【解决方案2】:

要更改关闭按钮文本,您可以传入一个选项,如标题(在对话框创建中),称为 closeText。

$("#dialog-confirm").dialog({
    title: title,
    closeText : 'hello' //Changes the text of the titlebar-close button to hello instead of default Close
    ...
    ...
})

要从关闭按钮中移除外发光(焦点),您可以进入标题栏关闭的 css 并将轮廓属性标记为零,如下所示:

.ui-dialog .ui-dialog-titlebar-close {
   outline: 0;
 }

【讨论】:

    猜你喜欢
    • 2011-06-03
    • 1970-01-01
    • 2016-04-13
    • 2010-10-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多