|
192 | 192 | <xi:include href="../includes/widget-option-disabled.xml" xmlns:xi="http://www.w3.org/2003/XInclude"/>
|
193 | 193 | <xi:include href="../includes/widget-option-hide.xml" xmlns:xi="http://www.w3.org/2003/XInclude"/>
|
194 | 194 | <xi:include href="../includes/widget-option-show.xml" xmlns:xi="http://www.w3.org/2003/XInclude"/>
|
195 |
| - <option name="classes" default="{}" example-value='{ "custom-header": "icon-warning" }'> |
| 195 | + <option name="classes" default="{}"> |
196 | 196 | <desc>
|
197 | 197 | <p>Additional (thematic) classes to add to the widget, in addition to the structural classes. The structural classes are used as keys of this option and the thematic classes are the values. See the <a href="#method-_addClass"><code>_addClass()</code> method</a> for using this in custom widgets. Check out the documentation of individual widgets to see which classes they support.</p>
|
198 | 198 | <p>The primary motivation of this option is to map structural classes to theme classes. In other words, any class prefixed with namespace and widget, like <code>"ui-progressbar-"</code>, is considered a structural class. These are always added to the widget. In contrast to that, any class not specific to the widget is considered a theme class. These could be part of jQuery UI's CSS framework, but can also come from other CSS frameworks or be defined in custom stylesheets.</p>
|
199 | 199 | <p class="warning">Setting the <code>classes</code> option after creation will override all default properties. To only change specific values, use deep setters, e.g. <code>.option( "classes.ui-progressbar-value", null )</code>.</p>
|
200 | 200 | </desc>
|
201 | 201 | <type name="Object" />
|
| 202 | + <example> |
| 203 | + <desc>Initialize a progressbar widget with the <code>classes</code> option specified, changing the theming for the <code>ui-progressbar</code> class:</desc> |
| 204 | + <code> |
| 205 | +$( ".selector" ).progressbar({ |
| 206 | + classes: { |
| 207 | + "ui-progressbar": "highlight" |
| 208 | + } |
| 209 | +}); |
| 210 | + </code> |
| 211 | + </example> |
| 212 | + <example> |
| 213 | + <desc>Get or set the <code>classes</code> option, after initialization:</desc> |
| 214 | + <code> |
| 215 | +// Getter |
| 216 | +var classes = $( ".selector" ).widget( "option", "classes" ); |
| 217 | + |
| 218 | +// Setter, override all classes |
| 219 | +$( ".selector" ).widget( "option", "classes", { "custom-header": "icon-warning" } ); |
| 220 | + |
| 221 | +// Setter, override just one class |
| 222 | +$( ".selector" ).widget( "option", "classes.custom-header", "icon-warning" ); |
| 223 | + </code> |
| 224 | + </example> |
202 | 225 | </option>
|
203 | 226 |
|
204 | 227 | </options>
|
|
0 commit comments