documentation-2.html 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325
  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 class="dropdown-header">Version 3 (Stable)</li>
  48. <li><a href="/options-3.html">Options</a></li>
  49. <li><a href="/methods-3.html">Methods</a></li>
  50. <li><a href="/events-3.html">Events</a></li>
  51. <li class="divider"></li>
  52. <li class="dropdown-header">Version 2.0.1 (Legacy)</li>
  53. <li><a href="/documentation-2.html">Documentation</a></li>
  54. </ul>
  55. </li>
  56. <li><a href="https://github.com/nostalgiaz/bootstrap-switch/issues">Bug reports</a></li>
  57. </ul>
  58. </nav>
  59. </div>
  60. </header>
  61. <div class="container content">
  62. <h1 class="page-header">Documentation &nbsp;<small>Version 2.0.1 (Legacy)</small></h1>
  63. <div id="options-2">
  64. <h2 class="page-header">Options</h2>
  65. <div class="alert alert-warning">
  66. <p>
  67. All the options are accepted only using <code>data-*</code> attributes on the element.<br>
  68. <code>checked</code>, <code>disabled</code> and <code>readonly</code> are exception to the rule, being
  69. default HTML input attributes.<br>
  70. Therefore, there is not any way to specify the options in JavaScript during initialization.
  71. </p>
  72. </div>
  73. <table class="table table-bordered table-striped table-responsive">
  74. <thead>
  75. <tr>
  76. <th>Name</th>
  77. <th>Type</th>
  78. <th>Description</th>
  79. <th>Values</th>
  80. <th>Default</th>
  81. </tr>
  82. </thead>
  83. <tbody>
  84. <tr>
  85. <td>state</td>
  86. <td>Boolean</td>
  87. <td>The checkbox state</td>
  88. <td>true, false</td>
  89. <td>'checked' attribute or true</td>
  90. </tr>
  91. <tr>
  92. <td>size</td>
  93. <td>String</td>
  94. <td>The checkbox state</td>
  95. <td>'', 'mini', 'small', 'normal', 'large'</td>
  96. <td>''</td>
  97. </tr>
  98. <tr>
  99. <td>animate</td>
  100. <td>Boolean</td>
  101. <td>Animate the switch</td>
  102. <td>true, false</td>
  103. <td>true</td>
  104. </tr>
  105. <tr>
  106. <td>disabled</td>
  107. <td>Boolean</td>
  108. <td>Disable state</td>
  109. <td>true, false</td>
  110. <td>'disabled' attribute or false</td>
  111. </tr>
  112. <tr>
  113. <td>readonly</td>
  114. <td>Boolean</td>
  115. <td>Readonly state</td>
  116. <td>true, false</td>
  117. <td>'readonly' attribute or false</td>
  118. </tr>
  119. <tr>
  120. <td>on</td>
  121. <td>String</td>
  122. <td>Color of the left side of the switch</td>
  123. <td>'primary', 'info', 'success', 'warning', 'danger', 'default'</td>
  124. <td>null</td>
  125. </tr>
  126. <tr>
  127. <td>off</td>
  128. <td>String</td>
  129. <td>Color of the right side of the switch</td>
  130. <td>'primary', 'info', 'success', 'warning', 'danger', 'default'</td>
  131. <td>null</td>
  132. </tr>
  133. <tr>
  134. <td>on-label</td>
  135. <td>String</td>
  136. <td>Text of the left side of the switch</td>
  137. <td>String</td>
  138. <td>'ON'</td>
  139. </tr>
  140. <tr>
  141. <td>off-label</td>
  142. <td>String</td>
  143. <td>Text of the right side of the switch</td>
  144. <td>String</td>
  145. <td>'OFF'</td>
  146. </tr>
  147. <tr>
  148. <td>text-label</td>
  149. <td>String</td>
  150. <td>Text of the center handle of the switch</td>
  151. <td>String</td>
  152. <td>'&amp;nbsp;'</td>
  153. </tr>
  154. <tr>
  155. <td>label-icon</td>
  156. <td>String</td>
  157. <td>Text of the center handle of the switch. Use to include external services icons</td>
  158. <td>String</td>
  159. <td>null</td>
  160. </tr>
  161. </tbody>
  162. </table>
  163. </div>
  164. <div id="methods-2">
  165. <h2 class="page-header">Methods</h2>
  166. <table class="table table-bordered table-striped table-responsive">
  167. <thead>
  168. <tr>
  169. <th>Name</th>
  170. <th>Description</th>
  171. <th>Accepted Values</th>
  172. <th>Returned Values</th>
  173. </tr>
  174. </thead>
  175. <tbody>
  176. <tr>
  177. <td>state</td>
  178. <td>Get checkbox state</td>
  179. <td></td>
  180. <td>true, false</td>
  181. </tr>
  182. <tr>
  183. <td>setState</td>
  184. <td>Set checkbox state</td>
  185. <td>(value: true, false)[, skip: true, <strong>false</strong>]</td>
  186. <td>jQuery Object (input element)</td>
  187. </tr>
  188. <tr>
  189. <td>toggleState</td>
  190. <td>Toggle checkbox state</td>
  191. <td>[skip: true, <strong>false</strong>]</td>
  192. <td>jQuery Object (input element)</td>
  193. </tr>
  194. <tr>
  195. <td>toggleRadioState</td>
  196. <td>Toggle radio state</td>
  197. <td>[skip: true, <strong>false</strong>]</td>
  198. <td>jQuery Object (input element)</td>
  199. </tr>
  200. <tr>
  201. <td>toggleRadioStateAllowUncheck</td>
  202. <td>Toggle radio state allowing uncheck of the radio input</td>
  203. <td>[uncheck: true, <strong>false</strong> | skip: true, <strong>false</strong>]</td>
  204. <td>jQuery Object (input element)</td>
  205. </tr>
  206. <tr>
  207. <td>setSizeClass</td>
  208. <td>Set the size of the switch</td>
  209. <td>'', 'mini', 'small', 'normal', 'large'</td>
  210. <td>jQuery Object (input element)</td>
  211. </tr>
  212. <tr>
  213. <td>setAnimated</td>
  214. <td>Animate the switch</td>
  215. <td>true, false</td>
  216. <td>jQuery Object (input element)</td>
  217. </tr>
  218. <tr>
  219. <td>isDisabled</td>
  220. <td>Get disabled state</td>
  221. <td></td>
  222. <td>true, false</td>
  223. </tr>
  224. <tr>
  225. <td>setDisabled</td>
  226. <td>Set disable state</td>
  227. <td>true, false</td>
  228. <td>jQuery Object (input element)</td>
  229. </tr>
  230. <tr>
  231. <td>toggleDisabled</td>
  232. <td>Toggle disabled state</td>
  233. <td></td>
  234. <td>jQuery Object (input element)</td>
  235. </tr>
  236. <tr>
  237. <td>isReadOnly</td>
  238. <td>Get Readonly state</td>
  239. <td></td>
  240. <td>true, false</td>
  241. </tr>
  242. <tr>
  243. <td>setReadOnly</td>
  244. <td>Set Readonly state</td>
  245. <td>true, false</td>
  246. <td>jQuery Object (input element)</td>
  247. </tr>
  248. <tr>
  249. <td>toggleReadOnly</td>
  250. <td>Toggle readonly state</td>
  251. <td></td>
  252. <td>jQuery Object (input element)</td>
  253. </tr>
  254. <tr>
  255. <td>setOnClass</td>
  256. <td>Color of the left side of the switch</td>
  257. <td>'primary', 'info', 'success', 'warning', 'danger', 'default'</td>
  258. <td>jQuery Object (input element)</td>
  259. </tr>
  260. <tr>
  261. <td>setOffClass</td>
  262. <td>Color of the right side of the switch</td>
  263. <td>'primary', 'info', 'success', 'warning', 'danger', 'default'</td>
  264. <td>jQuery Object (input element)</td>
  265. </tr>
  266. <tr>
  267. <td>setOnLabel</td>
  268. <td>Text of the left side of the switch</td>
  269. <td>String</td>
  270. <td>jQuery Object (input element)</td>
  271. </tr>
  272. <tr>
  273. <td>setOffLabel</td>
  274. <td>Text of the right side of the switch</td>
  275. <td>String</td>
  276. <td>jQuery Object (input element)</td>
  277. </tr>
  278. <tr>
  279. <td>setTextLabel</td>
  280. <td>Text of the center handle of the switch</td>
  281. <td>String</td>
  282. <td>null</td>
  283. </tr>
  284. <tr>
  285. <td>setTextIcon</td>
  286. <td>Text of the center handle of the switch. Use to include external services icons</td>
  287. <td>String</td>
  288. <td>null</td>
  289. </tr>
  290. <tr>
  291. <td>destroy</td>
  292. <td>Destroy the instance of Bootstrap Switch</td>
  293. <td></td>
  294. <td>jQuery Object (input element)</td>
  295. </tr>
  296. </tbody>
  297. </table>
  298. </div>
  299. <div id="events-2">
  300. <h2 class="page-header">Events</h2>
  301. <p>
  302. The only event triggered it <code>switch-change</code>. It returns two parameters: <code>event</code> and
  303. <code>data</code>.<br>
  304. The latter is an object that include <code>el</code> (the input DOM element) and <code>value</code> (the
  305. new input state)
  306. </p>
  307. </div>
  308. </div>
  309. <div class="container bottom">
  310. <p>
  311. Licensed under the
  312. <a href="http://www.apache.org/licenses/LICENSE-2.0" target="_blank">Apache License, Version 2.0</a>
  313. · Created by
  314. <a href="https://github.com/nostalgiaz" target="_blank">Mattia Larentis</a>
  315. · Mantained by
  316. <a href="https://github.com/lostcrew" target="_blank">Emanuele Marchi</a>
  317. </p>
  318. </div>
  319. <script src="docs/js/jquery.min.js"></script>
  320. <script src="docs/js/bootstrap.min.js"></script>
  321. <script src="docs/js/highlight.js"></script>
  322. <script src="dist/js/bootstrap-switch.js"></script>
  323. <script src="docs/js/main.js"></script>
  324. </body>
  325. </html>