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?
This issue turned up for me when I was trying to find a similar answer. Consider:
Where
abc
is the name of your 'CSS wrapper' - see Stack Overflow question Custom CSS scope and jQuery UI dialog themes where I found the answer from Evgeni Nabokov. For more information on the CSS wrapper in use with a jQuery UI dialog box - see the following (but note they do NOT really solve the issue of the CSS wrapper with the dialog box - you need the above comments to help there, Using Multiple jQuery UI Themes on a Single Page (Filament blog).Try these:
The best recommendation I can give for you is to load the page in Firefox, open the dialog and inspect it with Firebug, then try different selectors in the console, and see what works. You may need to use some of the other descendant selectors.