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?
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;}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With