1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154
|
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>jQuery Mobile Docs - Button options</title>
<link rel="stylesheet" href="../../css/themes/default/jquery.mobile-1.2.0.css" />
<link rel="stylesheet" href="../_assets/css/jqm-docs.css"/>
<script src="../../js/jquery.js"></script>
<script src="../../docs/_assets/js/jqm-docs.js"></script>
<script src="../../js/jquery.mobile-1.2.0.js"></script>
</head>
<body>
<div data-role="page" class="type-interior">
<div data-role="header" data-theme="f">
<h1>Button basics</h1>
<a href="../../" data-icon="home" data-iconpos="notext" data-direction="reverse">Home</a>
<a href="../nav.html" data-icon="search" data-iconpos="notext" data-rel="dialog" data-transition="fade">Search</a>
</div><!-- /header -->
<div data-role="content">
<div class="content-primary">
<form action="#" method="get">
<h2>Button basics</h2>
<ul data-role="controlgroup" data-type="horizontal" class="localnav">
<li><a href="buttons-types.html" data-role="button" data-transition="fade">Basics</a></li>
<li><a href="buttons-options.html" data-role="button" data-transition="fade" class="ui-btn-active">Options</a></li>
<li><a href="buttons-methods.html" data-role="button" data-transition="fade">Methods</a></li>
<li><a href="buttons-events.html" data-role="button" data-transition="fade">Events</a></li>
</ul>
<p>The following options apply to <strong>all buttons</strong>:</p>
<dl>
<dt><code>corners</code> <em>boolean</em></dt>
<dd>
<p class="default">default: true</p>
<p>Applies the theme button border-radius if set to true. This option is also exposed as a data attribute: <code>data-corners="false"</code></p>
<pre><code>$('a').buttonMarkup(<strong>{ corners: false }</strong>);</code></pre>
<a href="#" data-role="button" data-corners="false">No rounded corners</a>
</dd>
<dt><code>icon</code> <em>string</em></dt>
<dd>
<p class="default">default: null</p>
<p>Applies an icon from the <a href="../buttons/buttons-icons.html">icon set</a>. This option is also exposed as a data attribute: <code>data-icon="star"</code></p>
<pre><code>$('a').buttonMarkup(<strong>{ icon: "star" }</strong>);</code></pre>
<a href="#" data-role="button" data-icon="star">Star icon</a>
</dd>
<dt><code>iconpos</code> <em>string</em></dt>
<dd>
<p class="default">default: "left"</p>
<p>Positions the icon in the button. Possible values: left, right, top, bottom, none, notext. The notext value will display an icon-only button with no text feedback. This option is also exposed as a data attribute: <code>data-iconpos="left"</code></p>
<pre><code>$('a').buttonMarkup(<strong>{ iconpos: "right" }</strong>);</code></pre>
<a href="#" data-role="button" data-icon="star" data-iconpos="right">Star icon</a>
</dd>
<dt><code>iconshadow</code> <em>boolean</em></dt>
<dd>
<p class="default">default: true</p>
<p>Applies the theme shadow to the button's icon if set to true. This option is also exposed as a data attribute: <code>data-iconshadow="false"</code></p>
<pre><code>$('a').buttonMarkup(<strong>{ iconshadow: false }</strong>);</code></pre>
<a href="#" data-role="button" data-icon="star" data-iconshadow="false">No icon shadow</a>
</dd>
<dt><code>inline</code> <em>boolean</em></dt>
<dd>
<p class="default">default: null (false)</p>
<p>If set to true, this will make the button act like an inline button so the width is determined by the button's text. By default, this is null (false) so the button is full width, regardless of the feedback content. Possible values: true, false. This option is also exposed as a data attribute: <code>data-inline="true"</code></p>
<pre><code>$('a').buttonMarkup(<strong>{ inline: true }</strong>);</code></pre>
<a href="#" data-role="button" data-inline="true">Inline</a>
</dd>
<dt><code>mini</code> <em>boolean</em></dt>
<dd>
<p class="default">default: null (false)</p>
<p>If set to true, this will display a more compact version of the button that uses less vertical height. Possible values: true, false. This option is also exposed as a data attribute: <code>data-mini="true"</code></p>
<pre><code>$('a').buttonMarkup(<strong>{ mini: true }</strong>);</code></pre>
<a href="#" data-role="button" data-mini="true">Mini</a>
</dd>
<dt><code>shadow</code> <em>boolean</em></dt>
<dd>
<p class="default">default: true</p>
<p>Applies the drop shadow style to the button if set to true. This option is also exposed as a data attribute: <code>data-shadow="false"</code></p>
<pre><code>$('a').buttonMarkup(<strong>{ shadow: false }</strong>);</code></pre>
<a href="#" data-role="button" data-shadow="false">No button shadow</a>
</dd>
<dt><code>theme</code> <em>string</em></dt>
<dd>
<p class="default">default: null, inherited from parent</p>
<p>Sets the color scheme (swatch) for all instances of this widget. It accepts a single letter from a-z that maps to one of the swatches included in your theme. By default, it will inherit the same swatch color as its parent container if not explicitly set. This option is also exposed as a data attribute: <code>data-theme="a"</code></p>
<pre><code>$('a').buttonMarkup(<strong>{ theme: "a" }</strong>);</code></pre>
<a href="#" data-role="button" data-theme="a">Theme A</a>
</dd>
</dl>
<div class="ui-body ui-body-e">
<p>The following option applies only to <strong>form buttons</strong>, which are automatically initialized by the framework:</p>
</div>
<dl>
<dt><code>initSelector</code> <em>CSS selector string</em></dt>
<dd>
<p class="default">default: "button, [type='button'], [type='submit'], [type='reset']"</p>
<p>This is used to define the selectors (element types, data roles, etc.) that will automatically be initialized as form buttons. To change which elements are initialized, bind this option to the <a href="../api/globalconfig.html">mobileinit event</a>:</p>
<pre><code>$( document ).bind( "mobileinit", function(){
<strong>$.mobile.button.prototype.options.initSelector = ".myButtons";</strong>
});
</code></pre>
</dd>
</dl>
</form>
</div><!--/content-primary -->
<div class="content-secondary">
<div data-role="collapsible" data-collapsed="true" data-theme="b" data-content-theme="d">
<h3>More in this section</h3>
<ul data-role="listview" data-theme="c" data-dividertheme="d">
<li data-role="list-divider">Buttons</li>
<li data-theme="a"><a href="buttons-types.html">Button basics</a></li>
<li><a href="buttons-icons.html">Button icons</a></li>
<li><a href="buttons-inline.html">Inline buttons</a></li>
<li><a href="buttons-grouped.html">Grouped buttons</a></li>
<li><a href="buttons-themes.html">Theming buttons</a></li>
</ul>
</div>
</div>
</div><!-- /content -->
<div data-role="footer" class="footer-docs" data-theme="c">
<p class="jqm-version"></p>
<p>© 2012 jQuery Foundation and other contributors</p>
</div>
</div><!-- /page -->
</body>
</html>
|