0

Can any one please tel me that how to set background color of title bar of popup window in jquery.

Title text is "Email Options".

 function showEmailDlg() {

    var dlg = $('#dlgEmail').dialog(
           {
               draggable: true,
               position: 'center',
               modal: true,
               width: 1028,
               height: 568,
               title: 'Email Options',
               resizable: false

           }
       );

    dlg.parent().appendTo($("form:first"));
}
4

2 回答 2

1

Assuming you're using jQuery UI (it looks like you are), as far as I'm aware there's no documented option for it, but jQuery UI uses CSS for styling and makes sure the classes are fairly clear.

In this case, the dialog title element (a div) has the class ui-dialog-titlebar. You can apply styling using a selector matching that (e.g., #dlgEmail .ui-dialog-titlebar). If you just want the bit containing the title and not the full title bar, that's a span with class .ui-dialog-title. But note that there's a lot of intricate styling done in the jQuery UI stuff, it's going to be a bit non-trivial.

Using any half-decent browser, you can discover this stuff at runtime. For instance, with Chrome, just left-click the title bar and choose "Inspect element".

于 2012-11-20T08:22:50.217 回答
0

Try using,

$("#dlgEmail .ui-dialog-titlebar").css("background-color", "red");
于 2012-11-20T08:31:20.243 回答