client/player/development-bundle/docs/button.html
changeset 57 3a3c15c462f8
parent 48 44d58d2e90b5
parent 56 da0957782d03
child 58 ec1d0e7dcb53
equal deleted inserted replaced
48:44d58d2e90b5 57:3a3c15c462f8
     1 
       
     2 <ul class="UIAPIPlugin-toc">
       
     3 <li><a href="#overview">Overview</a></li>
       
     4 <li><a href="#options">Options</a></li>
       
     5 <li><a href="#events">Events</a></li>
       
     6 <li><a href="#methods">Methods</a></li>
       
     7 <li><a href="#theming">Theming</a></li>
       
     8 </ul>
       
     9 <div class="UIAPIPlugin">
       
    10   <h1>jQuery UI Button</h1>
       
    11   <div id="overview">
       
    12     <h2 class="top-header">Overview</h2>
       
    13     <div id="overview-main">
       
    14         <p>Button enhances standard form elements like button, input of type submit or reset or anchors to themable buttons with appropiate mouseover and active styles.</p>
       
    15 <p>In addition to basic push buttons, radio buttons and checkboxes (inputs of type radio and checkbox) can be converted to buttons: Their associated label is styled to appear as the button, while the underlying input is updated on click.</p>
       
    16 <p>In order to group radio buttons, Button also provides an additional widget-method, called Buttonset. Its used by selecting a container element (which contains the radio buttons) and calling buttonset(). Buttonset will also provide visual grouping, and therefore should be used whenever you have a group of buttons. It works by selecting all descendents and applying button() to them. You can enable and disable a buttonset, which will enable and disable all contained buttons. Destroying a buttonset also calls the button's destroy method.</p>
       
    17     </div>
       
    18     <div id="overview-dependencies">
       
    19         <h3>Dependencies</h3>
       
    20         <ul>
       
    21 <li>UI Core</li>
       
    22 <li>UI Widget</li>
       
    23 </ul>
       
    24     </div>
       
    25     <div id="overview-example">
       
    26         <h3>Example</h3>
       
    27         <div id="overview-example" class="example">
       
    28 <ul><li><a href="#demo"><span>Demo</span></a></li><li><a href="#source"><span>View Source</span></a></li></ul>
       
    29 <p><div id="demo" class="tabs-container" rel="300">
       
    30 A simple jQuery UI Button.<br />
       
    31 </p>
       
    32 <pre>$(&quot;button&quot;).button();
       
    33 </pre>
       
    34 <p></div><div id="source" class="tabs-container">
       
    35 </p>
       
    36 <pre>&lt;!DOCTYPE html&gt;
       
    37 &lt;html&gt;
       
    38 &lt;head&gt;
       
    39   &lt;link href=&quot;http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css&quot; rel=&quot;stylesheet&quot; type=&quot;text/css&quot;/&gt;
       
    40   &lt;script src=&quot;http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js&quot;&gt;&lt;/script&gt;
       
    41   &lt;script src=&quot;http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js&quot;&gt;&lt;/script&gt;
       
    42   
       
    43   &lt;script&gt;
       
    44   $(document).ready(function() {
       
    45     $(&quot;button&quot;).button();
       
    46   });
       
    47   &lt;/script&gt;
       
    48 &lt;/head&gt;
       
    49 &lt;body style="font-size:62.5%;"&gt;
       
    50   
       
    51 &lt;button&gt;Button label&lt;/button&gt;
       
    52 
       
    53 &lt;/body&gt;
       
    54 &lt;/html&gt;
       
    55 </pre>
       
    56 <p></div>
       
    57 </p><p></div>
       
    58 <div id="overview-example" class="example">
       
    59 <ul><li><a href="#demo"><span>Demo</span></a></li><li><a href="#source"><span>View Source</span></a></li></ul>
       
    60 <div id="demo" class="tabs-container" rel="300">
       
    61 A simple jQuery UI Button.<br />
       
    62 </p>
       
    63 <pre>$(&quot;#radio1&quot;).buttonset();
       
    64 </pre>
       
    65 <p></div><div id="source" class="tabs-container">
       
    66 </p>
       
    67 <pre>&lt;!DOCTYPE html&gt;
       
    68 &lt;html&gt;
       
    69 &lt;head&gt;
       
    70   &lt;link href=&quot;http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css&quot; rel=&quot;stylesheet&quot; type=&quot;text/css&quot;/&gt;
       
    71   &lt;script src=&quot;http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js&quot;&gt;&lt;/script&gt;
       
    72   &lt;script src=&quot;http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js&quot;&gt;&lt;/script&gt;
       
    73   
       
    74   &lt;script&gt;
       
    75   $(document).ready(function() {
       
    76     $(&quot;#radio1&quot;).buttonset();
       
    77   });
       
    78   &lt;/script&gt;
       
    79 &lt;/head&gt;
       
    80 &lt;body style="font-size:62.5%;"&gt;
       
    81   
       
    82 &lt;div id=&quot;radio1&quot;&gt;
       
    83 	&lt;input type=&quot;radio&quot; id=&quot;radio1&quot; name=&quot;radio&quot; /&gt;&lt;label for=&quot;radio1&quot;&gt;Choice 1&lt;/label&gt;
       
    84 	&lt;input type=&quot;radio&quot; id=&quot;radio2&quot; name=&quot;radio&quot; checked=&quot;checked&quot; /&gt;&lt;label for=&quot;radio2&quot;&gt;Choice 2&lt;/label&gt;
       
    85 	&lt;input type=&quot;radio&quot; id=&quot;radio3&quot; name=&quot;radio&quot; /&gt;&lt;label for=&quot;radio3&quot;&gt;Choice 3&lt;/label&gt;
       
    86 &lt;/div&gt;
       
    87 
       
    88 &lt;/body&gt;
       
    89 &lt;/html&gt;
       
    90 </pre>
       
    91 <p></div>
       
    92 </p><p></div>
       
    93     </div>
       
    94   </div>
       
    95   <div id="options">
       
    96     <h2 class="top-header">Options</h2>
       
    97     <ul class="options-list">
       
    98       
       
    99 <li class="option" id="option-disabled">
       
   100   <div class="option-header">
       
   101     <h3 class="option-name"><a href="#option-disabled">disabled</a></h3>
       
   102     <dl>
       
   103       <dt class="option-type-label">Type:</dt>
       
   104         <dd class="option-type">Boolean</dd>
       
   105       
       
   106       <dt class="option-default-label">Default:</dt>
       
   107         <dd class="option-default">false</dd>
       
   108       
       
   109     </dl>
       
   110   </div>
       
   111   <div class="option-description">
       
   112     <p>Disables (true) or enables (false) the button. Can be set when initialising (first creating) the button.</p>
       
   113   </div>
       
   114   <div class="option-examples">
       
   115     <h4>Code examples</h4>
       
   116     <dl class="option-examples-list">
       
   117     
       
   118 <dt>
       
   119   Initialize a button with the <code>disabled</code> option specified.
       
   120 </dt>
       
   121 <dd>
       
   122 <pre><code>$( ".selector" ).button({ disabled: true });</code></pre>
       
   123 </dd>
       
   124 
       
   125     
       
   126 <dt>
       
   127   Get or set the <code>disabled</code> option, after init.
       
   128 </dt>
       
   129 <dd>
       
   130 <pre><code>//getter
       
   131 var disabled = $( ".selector" ).button( "option", "disabled" );
       
   132 //setter
       
   133 $( ".selector" ).button( "option", "disabled", true );</code></pre>
       
   134 </dd>
       
   135 
       
   136     </dl>
       
   137   </div>
       
   138 </li>
       
   139 
       
   140 
       
   141 <li class="option" id="option-text">
       
   142   <div class="option-header">
       
   143     <h3 class="option-name"><a href="#option-text">text</a></h3>
       
   144     <dl>
       
   145       <dt class="option-type-label">Type:</dt>
       
   146         <dd class="option-type">Boolean</dd>
       
   147       
       
   148       <dt class="option-default-label">Default:</dt>
       
   149         <dd class="option-default">true</dd>
       
   150       
       
   151     </dl>
       
   152   </div>
       
   153   <div class="option-description">
       
   154     <p>Whether to show any text - when set to false (display no text), icons (see icons option) must be enabled, otherwise it'll be ignored.</p>
       
   155   </div>
       
   156   <div class="option-examples">
       
   157     <h4>Code examples</h4>
       
   158     <dl class="option-examples-list">
       
   159     
       
   160 <dt>
       
   161   Initialize a button with the <code>text</code> option specified.
       
   162 </dt>
       
   163 <dd>
       
   164 <pre><code>$( ".selector" ).button({ text: false });</code></pre>
       
   165 </dd>
       
   166 
       
   167     
       
   168 <dt>
       
   169   Get or set the <code>text</code> option, after init.
       
   170 </dt>
       
   171 <dd>
       
   172 <pre><code>//getter
       
   173 var text = $( ".selector" ).button( "option", "text" );
       
   174 //setter
       
   175 $( ".selector" ).button( "option", "text", false );</code></pre>
       
   176 </dd>
       
   177 
       
   178     </dl>
       
   179   </div>
       
   180 </li>
       
   181 
       
   182 
       
   183 <li class="option" id="option-icons">
       
   184   <div class="option-header">
       
   185     <h3 class="option-name"><a href="#option-icons">icons</a></h3>
       
   186     <dl>
       
   187       <dt class="option-type-label">Type:</dt>
       
   188         <dd class="option-type">Options</dd>
       
   189       
       
   190       <dt class="option-default-label">Default:</dt>
       
   191         <dd class="option-default">{ primary: null, secondary: null }</dd>
       
   192       
       
   193     </dl>
       
   194   </div>
       
   195   <div class="option-description">
       
   196     <p>Icons to display, with or without text (see text option). The primary icon is displayed on the left of the label text, the secondary on the right. Value for the primary and secondary properties must be a classname (String), eg. "ui-icon-gear". For using only a primary icon: icons: {primary:'ui-icon-locked'}. For using both primary and secondary icon: icons: {primary:'ui-icon-gear',secondary:'ui-icon-triangle-1-s'}</p>
       
   197   </div>
       
   198   <div class="option-examples">
       
   199     <h4>Code examples</h4>
       
   200     <dl class="option-examples-list">
       
   201     
       
   202 <dt>
       
   203   Initialize a button with the <code>icons</code> option specified.
       
   204 </dt>
       
   205 <dd>
       
   206 <pre><code>$( ".selector" ).button({ icons: {primary:'ui-icon-gear',secondary:'ui-icon-triangle-1-s'} });</code></pre>
       
   207 </dd>
       
   208 
       
   209     
       
   210 <dt>
       
   211   Get or set the <code>icons</code> option, after init.
       
   212 </dt>
       
   213 <dd>
       
   214 <pre><code>//getter
       
   215 var icons = $( ".selector" ).button( "option", "icons" );
       
   216 //setter
       
   217 $( ".selector" ).button( "option", "icons", {primary:'ui-icon-gear',secondary:'ui-icon-triangle-1-s'} );</code></pre>
       
   218 </dd>
       
   219 
       
   220     </dl>
       
   221   </div>
       
   222 </li>
       
   223 
       
   224 
       
   225 <li class="option" id="option-label">
       
   226   <div class="option-header">
       
   227     <h3 class="option-name"><a href="#option-label">label</a></h3>
       
   228     <dl>
       
   229       <dt class="option-type-label">Type:</dt>
       
   230         <dd class="option-type">String</dd>
       
   231       
       
   232       <dt class="option-default-label">Default:</dt>
       
   233         <dd class="option-default">HTML content of the button, or value attribute</dd>
       
   234       
       
   235     </dl>
       
   236   </div>
       
   237   <div class="option-description">
       
   238     <p>Text to show on the button. When not specified (null), the element's html content is used, or its value attribute when it's an input element of type submit or reset; or the html content of the associated label element if its an input of type radio or checkbox</p>
       
   239   </div>
       
   240   <div class="option-examples">
       
   241     <h4>Code examples</h4>
       
   242     <dl class="option-examples-list">
       
   243     
       
   244 <dt>
       
   245   Initialize a button with the <code>label</code> option specified.
       
   246 </dt>
       
   247 <dd>
       
   248 <pre><code>$( ".selector" ).button({ label: "custom label" });</code></pre>
       
   249 </dd>
       
   250 
       
   251     
       
   252 <dt>
       
   253   Get or set the <code>label</code> option, after init.
       
   254 </dt>
       
   255 <dd>
       
   256 <pre><code>//getter
       
   257 var label = $( ".selector" ).button( "option", "label" );
       
   258 //setter
       
   259 </p>
       
   260 $( ".selector" ).button( "option", "label", "custom label" );</code></pre>
       
   261 </dd>
       
   262 
       
   263     </dl>
       
   264   </div>
       
   265 </li>
       
   266 
       
   267     </ul>
       
   268   </div>
       
   269   <div id="events">
       
   270     <h2 class="top-header">Events</h2>
       
   271     <ul class="events-list">
       
   272       <p>There are no events for this plugin.</p>
       
   273     </ul>
       
   274   </div>
       
   275   <div id="methods">
       
   276     <h2 class="top-header">Methods</h2>
       
   277     <ul class="methods-list">
       
   278       
       
   279 <li class="method" id="method-destroy">
       
   280   <div class="method-header">
       
   281     <h3 class="method-name"><a href="#method-destroy">destroy</a></h3>
       
   282     <dl>
       
   283       <dt class="method-signature-label">Signature:</dt>
       
   284         <dd class="method-signature">.button( "destroy"
       
   285 
       
   286 
       
   287 
       
   288 
       
   289 
       
   290 
       
   291 
       
   292 )</dd>
       
   293     </dl>
       
   294   </div>
       
   295   <div class="method-description">
       
   296     <p>Remove the button functionality completely. This will return the element back to its pre-init state.</p>
       
   297   </div>
       
   298 </li>
       
   299 
       
   300 <p>
       
   301 <li class="method" id="method-disable">
       
   302   <div class="method-header">
       
   303     <h3 class="method-name"><a href="#method-disable">disable</a></h3>
       
   304     <dl>
       
   305       <dt class="method-signature-label">Signature:</dt>
       
   306         <dd class="method-signature">.button( "disable"
       
   307 
       
   308 
       
   309 
       
   310 
       
   311 
       
   312 
       
   313 
       
   314 )</dd>
       
   315     </dl>
       
   316   </div>
       
   317   <div class="method-description">
       
   318     <p>Disable the button.</p>
       
   319   </div>
       
   320 </li>
       
   321 
       
   322 
       
   323 <li class="method" id="method-enable">
       
   324   <div class="method-header">
       
   325     <h3 class="method-name"><a href="#method-enable">enable</a></h3>
       
   326     <dl>
       
   327       <dt class="method-signature-label">Signature:</dt>
       
   328         <dd class="method-signature">.button( "enable"
       
   329 
       
   330 
       
   331 
       
   332 
       
   333 
       
   334 
       
   335 
       
   336 )</dd>
       
   337     </dl>
       
   338   </div>
       
   339   <div class="method-description">
       
   340     <p>Enable the button.</p>
       
   341   </div>
       
   342 </li>
       
   343 
       
   344 
       
   345 <li class="method" id="method-option">
       
   346   <div class="method-header">
       
   347     <h3 class="method-name"><a href="#method-option">option</a></h3>
       
   348     <dl>
       
   349       <dt class="method-signature-label">Signature:</dt>
       
   350         <dd class="method-signature">.button( "option"
       
   351 
       
   352 , optionName
       
   353 
       
   354 , <span class="optional">[</span>value<span class="optional">] </span>
       
   355 
       
   356 
       
   357 
       
   358 )</dd>
       
   359     </dl>
       
   360   </div>
       
   361   <div class="method-description">
       
   362     <p>Get or set any button option. If no value is specified, will act as a getter.</p>
       
   363   </div>
       
   364 </li>
       
   365 
       
   366 
       
   367 <li class="method" id="method-option">
       
   368   <div class="method-header">
       
   369     <h3 class="method-name"><a href="#method-option">option</a></h3>
       
   370     <dl>
       
   371       <dt class="method-signature-label">Signature:</dt>
       
   372         <dd class="method-signature">.button( "option"
       
   373 
       
   374 , options
       
   375 
       
   376 
       
   377 
       
   378 
       
   379 
       
   380 )</dd>
       
   381     </dl>
       
   382   </div>
       
   383   <div class="method-description">
       
   384     <p>Set multiple button options at once by providing an options object.</p>
       
   385   </div>
       
   386 </li>
       
   387 
       
   388 
       
   389 <li class="method" id="method-widget">
       
   390   <div class="method-header">
       
   391     <h3 class="method-name"><a href="#method-widget">widget</a></h3>
       
   392     <dl>
       
   393       <dt class="method-signature-label">Signature:</dt>
       
   394         <dd class="method-signature">.button( "widget"
       
   395 
       
   396 
       
   397 
       
   398 
       
   399 
       
   400 
       
   401 
       
   402 )</dd>
       
   403     </dl>
       
   404   </div>
       
   405   <div class="method-description">
       
   406     <p>Returns the .ui-button element.</p>
       
   407   </div>
       
   408 </li>
       
   409 
       
   410 
       
   411 <li class="method" id="method-refresh">
       
   412   <div class="method-header">
       
   413     <h3 class="method-name"><a href="#method-refresh">refresh</a></h3>
       
   414     <dl>
       
   415       <dt class="method-signature-label">Signature:</dt>
       
   416         <dd class="method-signature">.button( "refresh"
       
   417 
       
   418 
       
   419 
       
   420 
       
   421 
       
   422 
       
   423 
       
   424 )</dd>
       
   425     </dl>
       
   426   </div>
       
   427   <div class="method-description">
       
   428     <p>Refreshes the visual state of the button. Useful for updating button state after the native element's checked or disabled state is changed programatically.</p>
       
   429   </div>
       
   430 </li>
       
   431 
       
   432     </ul>
       
   433   </div>
       
   434   <div id="theming">
       
   435     <h2 class="top-header">Theming</h2>
       
   436     <p>The jQuery UI Button plugin uses the jQuery UI CSS Framework to style its look and feel, including colors and background textures. We recommend using the ThemeRoller tool to create and download custom themes that are easy to build and maintain.
       
   437 </p>
       
   438   <p>If a deeper level of customization is needed, there are widget-specific classes referenced within the jquery.ui.button.css stylesheet that can be modified. These classes are highlighed in bold below.
       
   439 </p>
       
   440     
       
   441   <h3>Sample markup with jQuery UI CSS Framework classes</h3>
       
   442   &lt;button class=&quot;<strong>ui-button ui-button-text-only</strong> ui-widget ui-state-default ui-corner-all&quot;&gt;<br />
       
   443 &nbsp;&nbsp;&nbsp;&lt;span class=&quot;<strong>ui-button-text</strong>&quot;&gt;Button Label&lt;/span&gt;<br />&lt;/button&gt;
       
   444   <p class="theme-note">
       
   445     <strong>
       
   446       Note: This is a sample of markup generated by the button plugin, not markup you should use to create a button. The only markup needed for that is &lt;button&gt;Button Label&lt;/button&gt;.
       
   447     </strong>
       
   448   </p>
       
   449 
       
   450   </div>
       
   451 </div>
       
   452 
       
   453 </p><!-- 
       
   454 Pre-expand include size: 23021 bytes
       
   455 Post-expand include size: 28995 bytes
       
   456 Template argument size: 13372 bytes
       
   457 Maximum: 2097152 bytes
       
   458 -->
       
   459 
       
   460 <!-- Saved in parser cache with key jqdocs_docs:pcache:idhash:3767-1!1!0!!en!2 and timestamp 20100421091628 -->