index.jade 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477
  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
  10. link(href='http://fonts.googleapis.com/css?family=Roboto:400,700', rel='stylesheet')
  11. link(href='docs/lib/css/bootstrap.min.css', rel='stylesheet')
  12. link(href='docs/lib/css/highlight.css', rel='stylesheet')
  13. link(href='dist/css/bootstrap3/bootstrap-switch.css', rel='stylesheet')
  14. link(href='docs/index.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. body
  28. header.navbar.navbar-default.navbar-fixed-top.top(role='banner')
  29. .container
  30. .navbar-header
  31. button.navbar-toggle(type='button', data-toggle='collapse', data-target='#collapse')
  32. span.sr-only Toggle navigation
  33. span.icon-bar
  34. span.icon-bar
  35. span.icon-bar
  36. a.navbar-brand(href='../') Bootstrap Switch
  37. nav#collapse.collapse.navbar-collapse(role='navigation')
  38. ul.nav.navbar-nav
  39. li.dropdown
  40. a(href='#', data-toggle='dropdown')
  41. | Download
  42. span.caret
  43. ul.dropdown-menu
  44. li: a(href='https://github.com/nostalgiaz/bootstrap-switch/archive/3.0.zip') 3 (Release candidate)
  45. li: a(href='https://github.com/nostalgiaz/bootstrap-switch/archive/master.zip') 2.0.1
  46. li: a(href='#getting-started') Getting Started
  47. li.dropdown
  48. a(href='#documentation-3', data-toggle='dropdown')
  49. | Documentation 3
  50. span.caret
  51. ul.dropdown-menu
  52. li: a(href='#options') Options
  53. li: a(href='#methods') Methods
  54. li: a(href='#additional-methods') Additional Methods
  55. li: a(href='#events') Events
  56. li.dropdown
  57. a(href='#documentation-2', data-toggle='dropdown')
  58. | Documentation 2.0.1
  59. span.caret
  60. ul.dropdown-menu
  61. li: a(href='#options') Options
  62. li: a(href='#methods') Methods
  63. li: a(href='#events') Events
  64. //- li: a(href='#examples') Examples
  65. li: a(href='https://github.com/nostalgiaz/bootstrap-switch/issues') Bug reports
  66. .container
  67. .header
  68. h2.title Bootstrap Switch
  69. p.lead Turn checkboxes and radio buttons in toggle switches.
  70. p Download your version:
  71. p: input(type='checkbox', name='download-version', checked, data-size='large', data-on-text='3 RC', data-off-text='2.0.1')
  72. p
  73. a(href='https://github.com/nostalgiaz/bootstrap-switch/archive/3.0.zip', id='download-3', class='btn btn-lg btn-primary') Download 3 (Release candidate)
  74. a(href='https://github.com/nostalgiaz/bootstrap-switch/archive/master.zip', id='download-2' class='btn btn-lg btn-primary') Download 2.0.1 (Stable)
  75. #getting-started
  76. h1.page-header Getting Started
  77. p Include the dependencies: jQuery, Bootstrap and Bootstrap Switch CSS + Javascript.
  78. pre: code
  79. [...]
  80. <link href="bootstrap.css" rel="stylesheet">
  81. <link href="bootstrap-switch.css" rel="stylesheet">
  82. <script src="jquery.js"></script>
  83. <script src="bootstrap-switch.js"></script>
  84. [...]
  85. p Add your checkbox.
  86. pre: code <input type="checkbox" name="my-checkbox" checked>
  87. p Initialize Bootstrap Switch.
  88. pre: code $("[name='my-checkbox']").bootstrapSwitch();
  89. p Enjoy.
  90. #documentation-3
  91. h1.page-header Documentation 3
  92. #options
  93. h2 Options
  94. table.table.table-bordered.table-striped.table-responsive
  95. thead
  96. tr
  97. th Name
  98. th Type
  99. th Description
  100. th Values
  101. th Default
  102. tbody
  103. tr
  104. td state
  105. td Boolean
  106. td The checkbox state
  107. td true, false
  108. td 'checked' attribute or true
  109. tr
  110. td size
  111. td String
  112. td The checkbox state
  113. td 'mini', 'small', 'normal', 'large'
  114. td 'normal'
  115. tr
  116. td animate
  117. td Boolean
  118. td Animate the switch
  119. td true, false
  120. td true
  121. tr
  122. td disabled
  123. td Boolean
  124. td Disable state
  125. td true, false
  126. td 'disabled' attribute or false
  127. tr
  128. td readonly
  129. td Boolean
  130. td Readonly state
  131. td true, false
  132. td 'readonly' attribute or false
  133. tr
  134. td onColor
  135. td String
  136. td Color of the left side of the switch
  137. td 'primary', 'info', 'success', 'warning', 'danger', 'default'
  138. td: 'primary'
  139. tr
  140. td offColor
  141. td String
  142. td Color of the right side of the switch
  143. td 'primary', 'info', 'success', 'warning', 'danger', 'default'
  144. td: 'default'
  145. tr
  146. td onText
  147. td String
  148. td Text of the left side of the switch
  149. td String
  150. td: 'ON'
  151. tr
  152. td offText
  153. td String
  154. td Text of the right side of the switch
  155. td String
  156. td: 'OFF'
  157. tr
  158. td labelText
  159. td String
  160. td Text of the center handle of the switch
  161. td String
  162. td: ' '
  163. tr
  164. td baseClass
  165. td String
  166. td Prefix of every other used class
  167. td String
  168. td 'bootstrap-switch'
  169. tr
  170. td wrapperClass
  171. td String | Array
  172. td Container element class(es)
  173. td String | Array
  174. td 'wrapper'
  175. tr
  176. td onModifierClass
  177. td String
  178. td On Modifier class, used when the switch state is true
  179. td String
  180. td 'on'
  181. tr
  182. td offModifierClass
  183. td String
  184. td Off Modifier class, used when the switch state is false
  185. td String
  186. td 'off'
  187. tr
  188. td focusedModifierClass
  189. td String
  190. td Focused Modifier class, used when the switch is focused
  191. td String
  192. td 'focused'
  193. tr
  194. td animateModifierClass
  195. td String
  196. td Animate Modifier class, used to apply CSS animation to the switch
  197. td String
  198. td 'animate'
  199. tr
  200. td disabledModifierClass
  201. td String
  202. td Disabled Modifier class, used the switch is disabled
  203. td String
  204. td 'disabled'
  205. tr
  206. td readonlyModifierClass
  207. td String
  208. td Readonly Modifier class, used the switch is readonly
  209. td String
  210. td 'readonly'
  211. tr
  212. td onInit
  213. td Function
  214. td Callback function to execute on initialization
  215. td Function
  216. td: pre: code.javascript function(event, state) {}
  217. tr
  218. td onSwitchChange
  219. td Function
  220. td Callback function to execute on switch state change
  221. td Function
  222. td: pre: code.javascript function(event, state) {}
  223. #methods
  224. h2 Methods
  225. p In Bootstrap Switch, every option is also a method.
  226. p You can call a method in this way:
  227. pre: code $('input[name="my-checkbox"]').bootstrapSwitch('state'[, true][, true]);
  228. p If the second parameter is not specified, the current option is returned.
  229. p Pass 'true' to 'state' as third parameter, or to 'toggleState' as second parameter in order to avoid the `switchChange` event execution.
  230. #additional-methods
  231. h2 Additional Methods
  232. table.table.table-bordered.table-striped.table-responsive
  233. thead
  234. tr
  235. th Name
  236. th Description
  237. tbody
  238. tr
  239. td toggleState
  240. td Toggle the switch state
  241. tr
  242. td toggleDisabled
  243. td Toggle the disabled state
  244. tr
  245. td toggleReadonly
  246. td Toggle the readonly state
  247. tr
  248. td destroy
  249. td Destroy the instance of Bootstrap Switch
  250. #events
  251. h2 Events
  252. p You can register to the emitted events as follow:
  253. pre
  254. code
  255. | $('input[name="my-checkbox"]').on('switchChange.bootstrapSwitch', function(event, state) {
  256. | console.log(this); // DOM element
  257. | console.log(event); // jQuery event
  258. | console.log(state); // true | false
  259. | });
  260. table.table.table-bordered.table-striped.table-responsive
  261. thead
  262. tr
  263. th Name
  264. th Description
  265. th Parameters
  266. tbody
  267. tr
  268. td init
  269. td Triggered on initialization. 'this' refers to the DOM element.
  270. td
  271. | event (<a href="https://api.jquery.com/category/events/event-object/" target="_blank">jQuery Event object</a>)
  272. tr
  273. td switchChange
  274. td Triggered on switch state change. 'this' refers to the DOM element.
  275. td
  276. | event (<a href="https://api.jquery.com/category/events/event-object/" target="_blank">jQuery Event object</a>),
  277. | state (true | false)
  278. #examples
  279. h2 Examples
  280. small To be included
  281. //
  282. h3 State
  283. .row
  284. .col-sm-6
  285. input(type='checkbox', id='state-switch' checked)
  286. .col-sm-6
  287. .btn-group.pull-right
  288. button(type='button', id='state-switch-state', class='btn btn-default') Get State
  289. &nbsp;
  290. button(type='button', id='state-switch-on', class='btn btn-default') Set On
  291. &nbsp;
  292. button(type='button', id='state-switch-off', class='btn btn-default') Set Off
  293. &nbsp;
  294. button(type='button', id='state-switch-toggle', class='btn btn-default') Toggle State
  295. #documentation-2
  296. h1.page-header Documentation 2.0.1
  297. small To be included
  298. //
  299. #options
  300. h2 Options
  301. table.table.table-bordered.table-striped.table-responsive
  302. thead
  303. tr
  304. th Name
  305. th Type
  306. th Description
  307. th Values
  308. th Default
  309. tbody
  310. tr
  311. td state
  312. td Boolean
  313. td The checkbox state
  314. td true, false
  315. td 'checked' attribute or true
  316. tr
  317. td size
  318. td String
  319. td The checkbox state
  320. td 'mini', 'small', 'normal', 'large'
  321. td 'normal'
  322. tr
  323. td animate
  324. td Boolean
  325. td Animate the switch
  326. td true, false
  327. td true
  328. tr
  329. td disabled
  330. td Boolean
  331. td Disable state
  332. td true, false
  333. td 'disabled' attribute or false
  334. tr
  335. td readonly
  336. td Boolean
  337. td Readonly state
  338. td true, false
  339. td 'readonly' attribute or false
  340. tr
  341. td onColor
  342. td String
  343. td Color of the left side of the switch
  344. td 'primary', 'info', 'success', 'warning', 'danger', 'default'
  345. td: 'primary'
  346. tr
  347. td offColor
  348. td String
  349. td Color of the right side of the switch
  350. td 'primary', 'info', 'success', 'warning', 'danger', 'default'
  351. td: 'default'
  352. tr
  353. td onText
  354. td String
  355. td Text of the left side of the switch
  356. td String
  357. td: 'ON'
  358. tr
  359. td offText
  360. td String
  361. td Text of the right side of the switch
  362. td String
  363. td: 'OFF'
  364. tr
  365. td labelText
  366. td String
  367. td Text of the center handle of the switch
  368. td String
  369. td: '&amp;nbsp;'
  370. tr
  371. td baseClass
  372. td String
  373. td Prefix of every other used class
  374. td String
  375. td 'bootstrap-switch'
  376. tr
  377. td wrapperClass
  378. td String | Array
  379. td Container element class(es)
  380. td String | Array
  381. td 'wrapper'
  382. tr
  383. td containerClass
  384. td String | Array
  385. td Wrapper element class(es)
  386. td String | Array
  387. td 'container'
  388. tr
  389. td handleOnClass
  390. td String | Array
  391. td Handle On element class(es)
  392. td String | Array
  393. td 'handle-on'
  394. tr
  395. td handleOffClass
  396. td String | Array
  397. td Handle Off element class(es)
  398. td String | Array
  399. td 'handle-off'
  400. tr
  401. td labelClass
  402. td String | Array
  403. td Label element class(es)
  404. td String | Array
  405. td 'label'
  406. tr
  407. td onModifierClass
  408. td String
  409. td On Modifier class, used when the switch state is true
  410. td String
  411. td 'on'
  412. tr
  413. td offModifierClass
  414. td String
  415. td Off Modifier class, used when the switch state is false
  416. td String
  417. td 'off'
  418. tr
  419. td focusedModifierClass
  420. td String
  421. td Focused Modifier class, used when the switch is focused
  422. td String
  423. td 'focused'
  424. tr
  425. td animateModifierClass
  426. td String
  427. td Animate Modifier class, used to apply CSS animation to the switch
  428. td String
  429. td 'animate'
  430. tr
  431. td disabledModifierClass
  432. td String
  433. td Disabled Modifier class, used the switch is disabled
  434. td String
  435. td 'disabled'
  436. tr
  437. td readonlyModifierClass
  438. td String
  439. td Readonly Modifier class, used the switch is readonly
  440. td String
  441. td 'readonly'
  442. tr
  443. td onInit
  444. td Function
  445. td Callback function to execute on initialization
  446. td Function
  447. td: pre: code.javascript function(event, state) {}
  448. tr
  449. td onSwitchChange
  450. td Function
  451. td Callback function to execute on switch state change
  452. td Function
  453. td: pre: code.javascript function(event, state) {}
  454. script(src='docs/lib/js/jquery.min.js')
  455. script(src='docs/lib/js/bootstrap.min.js')
  456. script(src='docs/lib/js/highlight.js')
  457. script(src='dist/js/bootstrap-switch.js')
  458. script(src='docs/index.js')