javascript - Application of styling widgets in jQuery seems to differ -
in code snippet demonstrate how i'm applying different classes 2 different accordion
widgets using #divid .class
. works great, when try apply style dialog
widget, doesn't perform same. can't figure out. why same rules not apply? i'm new jquery.
$(function() { $("#dialog").dialog(); }); $(function() { $("#dialog2").dialog(); }); $(function() { $("#accordion").accordion(); }); $(function() { $("#accordion2").accordion(); });
#dialog .ui-dialog-titlebar { background-image: none; background-color: red; } #dialog2 .ui-dialog-titlebar { background-image: none; background-color: green; } #accordion .ui-accordion-header { background-image: none; background-color: red; } #accordion2 .ui-accordion-header { background-image: none; background-color: green; }
<script src="http://code.jquery.com/jquery-1.11.0.min.js"></script> <link rel="stylesheet" href="http://code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css"> <script src="http://code.jquery.com/ui/1.11.4/jquery-ui.js"></script> <div id="dialog" title="dialog"> <h3>1</h3> <div></div> <h3>2</h3> <div></div> </div> <div id="dialog2" title="dialog 2"> <h3>1</h3> <div></div> <h3>2</h3> <div></div> </div> <div id="accordion"> <h3>1</h3> <div></div> <h3>2</h3> <div></div> </div> <div id="accordion2"> <h3>1</h3> <div></div> <h3>2</h3> <div></div> </div>
the element call dialog()
on not outer wrapper title bar in...the title sibling since plugin wraps element outer element contains both.
there option set class on outer wrapper:
$("#dialog").dialog({dialogclass: "dialog-red"});
then in css:
.dialog-red .ui-dialog-titlebar { background-image: none; background-color: red; }
$(function() { $("#dialog").dialog({ dialogclass: "dialog-red" }); });
.dialog-red .ui-dialog-titlebar { background-image: none; background-color: red; }
<script src="http://code.jquery.com/jquery-1.11.0.min.js"></script> <link rel="stylesheet" href="http://code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css"> <script src="http://code.jquery.com/ui/1.11.4/jquery-ui.js"></script> <div id="dialog" title="dialog"> <h3>1</h3> <div></div> <h3>2</h3> <div></div> </div>
Comments
Post a Comment