jQuery UI Dialog individual CSS styling

前端 未结 8 2648
孤城傲影
孤城傲影 2020-12-05 09:28

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

相关标签:
8条回答
  • 2020-12-05 10:34

    The standard way to do this is with jQuery UI's CSS Scopes:

    <div class="myCssScope">
       <!-- dialog goes here -->
    </div>
    

    Unfortunately, the jQuery UI dialog moves the dialog DOM elements to the end of the document, to fix potential z-index issues. This means the scoping won't work (it will no longer have a ".myCssScope" ancestor).

    Christoph Herold designed a workaround which I've implemented as a jQuery plugin, maybe that will help.

    0 讨论(0)
  • 2020-12-05 10:35

    Try these:

    #dialog_style1 .ui-dialog-titlebar { display:none; }
    #dialog_style2 .ui-dialog-titlebar { color:#aaa; }
    

    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.

    0 讨论(0)
提交回复
热议问题