Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jQuery UI Dialog individual CSS styling

I'm looking to style a modal dialog (using UI Dialog) with unique CSS that is separate from the traditional dialog, so in essence to have two jQuery dialogs that each look different.

I've styled one, for example,

<div id="dialog_style1" class="dialog1 hidden">One content</div> 

and another

<div id="dialog_style2" class="dialog2 hidden">Another content</div> 

Unfortunately I've noticed that using separate CSS to style parts of the dialog box, like

.dialog1 .ui-dialog-titlebar { display:none; } .dialog2 .ui-dialog-titlebar { color:#aaa; } 

doesn't work because .ui-dialog-titlebar does not have the class .dialog1, and I can't do an addClass either without breaking into the plugin.

An alternative would be to have an element like body have a unique class/id (depending on which one I want), but that would preclude having both dialogs in the same page.

How can I do this?

like image 310
Rio Avatar asked Aug 20 '09 19:08

Rio


1 Answers

The current version of dialog has the option "dialogClass" which you can use with your id's. For example,

$('foo').dialog({dialogClass:'dialog_style1'}); 

Then the CSS would be

.dialog_style1 {color:#aaa;} 
like image 112
Morgan T. Avatar answered Sep 25 '22 07:09

Morgan T.