index.jade 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311
  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='build/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: a(href='https://github.com/nostalgiaz/bootstrap-switch/archive/3.0.zip') Download 3RC
  40. li: a(href='#getting-started') Getting Started
  41. li.dropdown
  42. a(href='#documentation', data-toggle='dropdown')
  43. | Documentation
  44. span.caret
  45. ul.dropdown-menu
  46. li: a(href='#options') Options
  47. li: a(href='#methods') Methods
  48. li: a(href='#events') Events
  49. li: a(href='#examples') Examples
  50. li: a(href='https://github.com/nostalgiaz/bootstrap-switch/issues') Bug reports
  51. .container
  52. .header
  53. h1.title Bootstrap Switch
  54. p.lead Turn checkboxes and radio buttons in toggle switches.
  55. p Choose your version:
  56. p: input(type='checkbox', name='download-version', checked, data-size='large', data-on-text='3 RC', data-off-text='2.0.1')
  57. p
  58. 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)
  59. a(href='https://github.com/nostalgiaz/bootstrap-switch/archive/master.zip', id='download-2' class='btn btn-lg btn-primary') Download 2.0.1
  60. #getting-started
  61. h1.page-header Getting Started
  62. p Include the dependencies: jQuery, Bootstrap and Bootstrap Switch CSS + Javascript.
  63. pre
  64. code
  65. [...]
  66. <link href="bootstrap.css" rel="stylesheet">
  67. <link href="bootstrap-switch.css" rel="stylesheet">
  68. <script src="jquery.js"></script>
  69. <script src="bootstrap-switch.js"></script>
  70. [...]
  71. #options
  72. h1.page-header Options
  73. table.table.table-bordered.table-striped.table-responsive
  74. thead
  75. tr
  76. th Name
  77. th Type
  78. th Description
  79. th Values
  80. th Default
  81. tbody
  82. tr
  83. td state
  84. td Boolean
  85. td The checkbox state
  86. td true, false
  87. td 'checked' attribute or true
  88. tr
  89. td size
  90. td String
  91. td The checkbox state
  92. td 'mini', 'small', 'normal', 'large'
  93. td 'normal'
  94. tr
  95. td animate
  96. td Boolean
  97. td Animate the switch
  98. td true, false
  99. td true
  100. tr
  101. td disabled
  102. td Boolean
  103. td Disable state
  104. td true, false
  105. td 'disabled' attribute or false
  106. tr
  107. td readonly
  108. td Boolean
  109. td Readonly state
  110. td true, false
  111. td 'readonly' attribute or false
  112. tr
  113. td onColor
  114. td String
  115. td Color of the left side of the switch
  116. td 'primary', 'info', 'success', 'warning', 'danger', 'default'
  117. td: 'primary'
  118. tr
  119. td offColor
  120. td String
  121. td Color of the right side of the switch
  122. td 'primary', 'info', 'success', 'warning', 'danger', 'default'
  123. td: 'default'
  124. tr
  125. td onText
  126. td String
  127. td Text of the left side of the switch
  128. td String
  129. td: 'ON'
  130. tr
  131. td offText
  132. td String
  133. td Text of the right side of the switch
  134. td String
  135. td: 'OFF'
  136. tr
  137. td labelText
  138. td String
  139. td Text of the center handle of the switch
  140. td String
  141. td: ' '
  142. tr
  143. td baseClass
  144. td String
  145. td Prefix of every other used class
  146. td String
  147. td 'bootstrap-switch'
  148. tr
  149. td wrapperClass
  150. td String | Array
  151. td Container element class(es)
  152. td String | Array
  153. td 'wrapper'
  154. tr
  155. td containerClass
  156. td String | Array
  157. td Wrapper element class(es)
  158. td String | Array
  159. td 'container'
  160. tr
  161. td handleOnClass
  162. td String | Array
  163. td Handle On element class(es)
  164. td String | Array
  165. td 'handle-on'
  166. tr
  167. td handleOffClass
  168. td String | Array
  169. td Handle Off element class(es)
  170. td String | Array
  171. td 'handle-off'
  172. tr
  173. td labelClass
  174. td String | Array
  175. td Label element class(es)
  176. td String | Array
  177. td 'label'
  178. tr
  179. td onModifierClass
  180. td String
  181. td On Modifier class, used when the switch state is true
  182. td String
  183. td 'on'
  184. tr
  185. td offModifierClass
  186. td String
  187. td Off Modifier class, used when the switch state is false
  188. td String
  189. td 'off'
  190. tr
  191. td focusedModifierClass
  192. td String
  193. td Focused Modifier class, used when the switch is focused
  194. td String
  195. td 'focused'
  196. tr
  197. td animateModifierClass
  198. td String
  199. td Animate Modifier class, used to apply CSS animation to the switch
  200. td String
  201. td 'animate'
  202. tr
  203. td disabledModifierClass
  204. td String
  205. td Disabled Modifier class, used the switch is disabled
  206. td String
  207. td 'disabled'
  208. tr
  209. td readonlyModifierClass
  210. td String
  211. td Readonly Modifier class, used the switch is readonly
  212. td String
  213. td 'readonly'
  214. tr
  215. td onInit
  216. td Function
  217. td Callback function to execute on initialization
  218. td Function
  219. td: pre: code.javascript function(event, state) {}
  220. tr
  221. td onSwitchChange
  222. td Function
  223. td Callback function to execute on switch state change
  224. td Function
  225. td: pre: code.javascript function(event, state) {}
  226. #methods
  227. h1.page-header Methods
  228. p In Bootstrap Switch, every option is also a method.
  229. p You can call a method in this way:
  230. pre: code $('input[name="my-checkbox"]').bootstrapSwitch('state', true);
  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. h1.page-header Events
  252. p You can register to the emitted events as follow:
  253. pre
  254. code
  255. | $('inputy[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. h1.page-header Examples
  280. h2 State
  281. .row
  282. .col-sm-6
  283. input(type='checkbox', id='state-switch' checked)
  284. .col-sm-6
  285. .btn-group.pull-right
  286. button(type='button', id='state-switch-state', class='btn btn-default') Get State
  287. &nbsp;
  288. button(type='button', id='state-switch-on', class='btn btn-default') Set On
  289. &nbsp;
  290. button(type='button', id='state-switch-off', class='btn btn-default') Set Off
  291. &nbsp;
  292. button(type='button', id='state-switch-toggle', class='btn btn-default') Toggle State
  293. <p>Working on this...</p>
  294. script(src='docs/lib/js/jquery.min.js')
  295. script(src='docs/lib/js/bootstrap.min.js')
  296. script(src='docs/lib/js/highlight.js')
  297. script(src='build/js/bootstrap-switch.js')
  298. script(src='docs/index.js')