documentation-2.html 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  6. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  7. <meta name="description" content="Turn checkboxes and radio buttons in toggle switches.">
  8. <meta name="author" content="Mattia Larentis, Emanuele Marchi and Peter Stein">
  9. <title>Bootstrap Switch · Turn checkboxes and radio buttons in toggle switches</title>
  10. <link href="http://fonts.googleapis.com/css?family=Roboto:400,700" rel="stylesheet">
  11. <link href="docs/css/bootstrap.min.css" rel="stylesheet">
  12. <link href="docs/css/highlight.css" rel="stylesheet">
  13. <link href="dist/css/bootstrap3/bootstrap-switch.css" rel="stylesheet">
  14. <link href="docs/css/main.css" rel="stylesheet">
  15. <script>
  16. var _gaq = _gaq || [];
  17. _gaq.push(['_setAccount', 'UA-43092768-1']);
  18. _gaq.push(['_trackPageview']);
  19. (function () {
  20. var ga = document.createElement('script');
  21. ga.type = 'text/javascript';
  22. ga.async = true;
  23. ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
  24. var s = document.getElementsByTagName('script')[0];
  25. s.parentNode.insertBefore(ga, s);
  26. })();
  27. </script>
  28. </head>
  29. <body><a href="https://github.com/nostalgiaz/bootstrap-switch" id="github"><img src="https://s3.amazonaws.com/github/ribbons/forkme_right_gray_6d6d6d.png" alt="Fork me on GitHub"></a>
  30. <header role="banner" class="navbar navbar-default navbar-fixed-top top">
  31. <div class="container">
  32. <div class="navbar-header">
  33. <button type="button" data-toggle="collapse" data-target="#collapse" class="navbar-toggle"><span class="sr-only">Toggle navigation</span><span class="icon-bar"></span><span class="icon-bar"></span><span class="icon-bar"></span></button><a href="../" class="navbar-brand">Bootstrap Switch <strong>3</strong></a>
  34. </div>
  35. <nav id="collapse" role="navigation" class="collapse navbar-collapse">
  36. <ul class="nav navbar-nav">
  37. <li class="dropdown"><a href="#" data-toggle="dropdown">Download<span class="caret"></span></a>
  38. <ul class="dropdown-menu">
  39. <li><a href="https://github.com/nostalgiaz/bootstrap-switch/archive/master.zip">3 (Stable)</a></li>
  40. <li><a href="https://github.com/nostalgiaz/bootstrap-switch/archive/v2.0.1.zip">2.0.1 (Legacy)</a></li>
  41. </ul>
  42. </li>
  43. <li><a href="index.html">Start</a></li>
  44. <li><a href="examples.html">Examples</a></li>
  45. <li class="dropdown"><a href="#" data-toggle="dropdown">Documentation<span class="caret"></span></a>
  46. <ul class="dropdown-menu">
  47. <li><a href="/documentation-3.html">Version 3 (Stable)</a></li>
  48. <li><a href="/documentation-2.html">Version 2.0.1 (Legacy)</a></li>
  49. </ul>
  50. </li>
  51. <li><a href="https://github.com/nostalgiaz/bootstrap-switch/issues">Bug reports</a></li>
  52. </ul>
  53. </nav>
  54. </div>
  55. </header>
  56. <div class="container content">
  57. <h1 class="page-header">Documentation 2.0.1 (Legacy)</h1>
  58. <div id="options-2">
  59. <h2 class="page-header">Options</h2>
  60. <div class="alert alert-warning">
  61. <p>
  62. All the options are accepted only using <code>data-*</code> attributes on the element.<br>
  63. <code>checked</code>, <code>disabled</code> and <code>readonly</code> are exception to the rule, being
  64. default HTML input attributes.<br>
  65. Therefore, there is not any way to specify the options in JavaScript during initialization.
  66. </p>
  67. </div>
  68. <table class="table table-bordered table-striped table-responsive">
  69. <thead>
  70. <tr>
  71. <th>Name</th>
  72. <th>Type</th>
  73. <th>Description</th>
  74. <th>Values</th>
  75. <th>Default</th>
  76. </tr>
  77. </thead>
  78. <tbody>
  79. <tr>
  80. <td>state</td>
  81. <td>Boolean</td>
  82. <td>The checkbox state</td>
  83. <td>true, false</td>
  84. <td>'checked' attribute or true</td>
  85. </tr>
  86. <tr>
  87. <td>size</td>
  88. <td>String</td>
  89. <td>The checkbox state</td>
  90. <td>'', 'mini', 'small', 'normal', 'large'</td>
  91. <td>''</td>
  92. </tr>
  93. <tr>
  94. <td>animate</td>
  95. <td>Boolean</td>
  96. <td>Animate the switch</td>
  97. <td>true, false</td>
  98. <td>true</td>
  99. </tr>
  100. <tr>
  101. <td>disabled</td>
  102. <td>Boolean</td>
  103. <td>Disable state</td>
  104. <td>true, false</td>
  105. <td>'disabled' attribute or false</td>
  106. </tr>
  107. <tr>
  108. <td>readonly</td>
  109. <td>Boolean</td>
  110. <td>Readonly state</td>
  111. <td>true, false</td>
  112. <td>'readonly' attribute or false</td>
  113. </tr>
  114. <tr>
  115. <td>on</td>
  116. <td>String</td>
  117. <td>Color of the left side of the switch</td>
  118. <td>'primary', 'info', 'success', 'warning', 'danger', 'default'</td>
  119. <td>null</td>
  120. </tr>
  121. <tr>
  122. <td>off</td>
  123. <td>String</td>
  124. <td>Color of the right side of the switch</td>
  125. <td>'primary', 'info', 'success', 'warning', 'danger', 'default'</td>
  126. <td>null</td>
  127. </tr>
  128. <tr>
  129. <td>on-label</td>
  130. <td>String</td>
  131. <td>Text of the left side of the switch</td>
  132. <td>String</td>
  133. <td>'ON'</td>
  134. </tr>
  135. <tr>
  136. <td>off-label</td>
  137. <td>String</td>
  138. <td>Text of the right side of the switch</td>
  139. <td>String</td>
  140. <td>'OFF'</td>
  141. </tr>
  142. <tr>
  143. <td>text-label</td>
  144. <td>String</td>
  145. <td>Text of the center handle of the switch</td>
  146. <td>String</td>
  147. <td>'&amp;nbsp;'</td>
  148. </tr>
  149. <tr>
  150. <td>label-icon</td>
  151. <td>String</td>
  152. <td>Text of the center handle of the switch. Use to include external services icons</td>
  153. <td>String</td>
  154. <td>null</td>
  155. </tr>
  156. </tbody>
  157. </table>
  158. </div>
  159. <div id="methods-2">
  160. <h2 class="page-header">Methods</h2>
  161. <table class="table table-bordered table-striped table-responsive">
  162. <thead>
  163. <tr>
  164. <th>Name</th>
  165. <th>Description</th>
  166. <th>Accepted Values</th>
  167. <th>Returned Values</th>
  168. </tr>
  169. </thead>
  170. <tbody>
  171. <tr>
  172. <td>state</td>
  173. <td>Get checkbox state</td>
  174. <td></td>
  175. <td>true, false</td>
  176. </tr>
  177. <tr>
  178. <td>setState</td>
  179. <td>Set checkbox state</td>
  180. <td>(value: true, false)[, skip: true, <strong>false</strong>]</td>
  181. <td>jQuery Object (input element)</td>
  182. </tr>
  183. <tr>
  184. <td>toggleState</td>
  185. <td>Toggle checkbox state</td>
  186. <td>[skip: true, <strong>false</strong>]</td>
  187. <td>jQuery Object (input element)</td>
  188. </tr>
  189. <tr>
  190. <td>toggleRadioState</td>
  191. <td>Toggle radio state</td>
  192. <td>[skip: true, <strong>false</strong>]</td>
  193. <td>jQuery Object (input element)</td>
  194. </tr>
  195. <tr>
  196. <td>toggleRadioStateAllowUncheck</td>
  197. <td>Toggle radio state allowing uncheck of the radio input</td>
  198. <td>[uncheck: true, <strong>false</strong> | skip: true, <strong>false</strong>]</td>
  199. <td>jQuery Object (input element)</td>
  200. </tr>
  201. <tr>
  202. <td>setSizeClass</td>
  203. <td>Set the size of the switch</td>
  204. <td>'', 'mini', 'small', 'normal', 'large'</td>
  205. <td>jQuery Object (input element)</td>
  206. </tr>
  207. <tr>
  208. <td>setAnimated</td>
  209. <td>Animate the switch</td>
  210. <td>true, false</td>
  211. <td>jQuery Object (input element)</td>
  212. </tr>
  213. <tr>
  214. <td>isDisabled</td>
  215. <td>Get disabled state</td>
  216. <td></td>
  217. <td>true, false</td>
  218. </tr>
  219. <tr>
  220. <td>setDisabled</td>
  221. <td>Set disable state</td>
  222. <td>true, false</td>
  223. <td>jQuery Object (input element)</td>
  224. </tr>
  225. <tr>
  226. <td>toggleDisabled</td>
  227. <td>Toggle disabled state</td>
  228. <td></td>
  229. <td>jQuery Object (input element)</td>
  230. </tr>
  231. <tr>
  232. <td>isReadOnly</td>
  233. <td>Get Readonly state</td>
  234. <td></td>
  235. <td>true, false</td>
  236. </tr>
  237. <tr>
  238. <td>setReadOnly</td>
  239. <td>Set Readonly state</td>
  240. <td>true, false</td>
  241. <td>jQuery Object (input element)</td>
  242. </tr>
  243. <tr>
  244. <td>toggleReadOnly</td>
  245. <td>Toggle readonly state</td>
  246. <td></td>
  247. <td>jQuery Object (input element)</td>
  248. </tr>
  249. <tr>
  250. <td>setOnClass</td>
  251. <td>Color of the left side of the switch</td>
  252. <td>'primary', 'info', 'success', 'warning', 'danger', 'default'</td>
  253. <td>jQuery Object (input element)</td>
  254. </tr>
  255. <tr>
  256. <td>setOffClass</td>
  257. <td>Color of the right side of the switch</td>
  258. <td>'primary', 'info', 'success', 'warning', 'danger', 'default'</td>
  259. <td>jQuery Object (input element)</td>
  260. </tr>
  261. <tr>
  262. <td>setOnLabel</td>
  263. <td>Text of the left side of the switch</td>
  264. <td>String</td>
  265. <td>jQuery Object (input element)</td>
  266. </tr>
  267. <tr>
  268. <td>setOffLabel</td>
  269. <td>Text of the right side of the switch</td>
  270. <td>String</td>
  271. <td>jQuery Object (input element)</td>
  272. </tr>
  273. <tr>
  274. <td>setTextLabel</td>
  275. <td>Text of the center handle of the switch</td>
  276. <td>String</td>
  277. <td>null</td>
  278. </tr>
  279. <tr>
  280. <td>setTextIcon</td>
  281. <td>Text of the center handle of the switch. Use to include external services icons</td>
  282. <td>String</td>
  283. <td>null</td>
  284. </tr>
  285. <tr>
  286. <td>destroy</td>
  287. <td>Destroy the instance of Bootstrap Switch</td>
  288. <td></td>
  289. <td>jQuery Object (input element)</td>
  290. </tr>
  291. </tbody>
  292. </table>
  293. </div>
  294. <div id="events-2">
  295. <h2 class="page-header">Events</h2>
  296. <p>
  297. The only event triggered it <code>switch-change</code>. It returns two parameters: <code>event</code> and
  298. <code>data</code>.<br>
  299. The latter is an object that include <code>el</code> (the input DOM element) and <code>value</code> (the
  300. new input state)
  301. </p>
  302. </div>
  303. </div>
  304. <div class="container bottom">
  305. <p>
  306. Licensed under the
  307. <a href="http://www.apache.org/licenses/LICENSE-2.0" target="_blank">Apache License, Version 2.0</a>
  308. · Created by
  309. <a href="https://github.com/nostalgiaz" target="_blank">Mattia Larentis</a>
  310. · Mantained by
  311. <a href="https://github.com/lostcrew" target="_blank">Emanuele Marchi</a>
  312. </p>
  313. </div>
  314. <script src="docs/js/jquery.min.js"></script>
  315. <script src="docs/js/bootstrap.min.js"></script>
  316. <script src="docs/js/highlight.js"></script>
  317. <script src="dist/js/bootstrap-switch.js"></script>
  318. <script src="docs/js/main.js"></script>
  319. </body>
  320. </html>