index.jade 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256
  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. //-
  50. li: a(href='#size') Size
  51. li: a(href='#colors') Colors
  52. li: a(href='#animation') Animation
  53. li: a(href='#disabled') Disabled / Readonly
  54. li: a(href='#text') Text
  55. li: a(href='#label-text') Label Text
  56. li: a(href='#icon-label-text') Icon Label Text
  57. li: a(href='#event-handlers') Event Handlers
  58. li: a(href='#label-event-handler') Label Event Handlers
  59. li: a(href='#state') State
  60. li: a(href='#destroy') Destroy
  61. li: a(href='#disable') Disable / Readonly
  62. li: a(href='#radio') Radio
  63. li: a(href='#form') Form
  64. li: a(href='#modal') Modal
  65. li: a(href='#examples') Examples
  66. li: a(href='https://github.com/nostalgiaz/bootstrap-switch/issues') Bug reports
  67. .container
  68. .header
  69. h1.title Bootstrap Switch
  70. p.lead Turn checkboxes and radio buttons in toggle switches.
  71. p Choose your version:
  72. p: input(type='checkbox', name='download-version', checked, data-size='large', data-on-text='3 RC', data-off-text='2.0.1')
  73. p
  74. 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)
  75. a(href='https://github.com/nostalgiaz/bootstrap-switch/archive/master.zip', id='download-2' class='btn btn-lg btn-primary') Download 2.0.1
  76. #getting-started
  77. h1.page-header Getting Started
  78. p Include the dependencies: jQuery, Bootstrap and Bootstrap Switch CSS + Javascript.
  79. pre
  80. code
  81. [...]
  82. <link href="bootstrap.css" rel="stylesheet">
  83. <link href="bootstrap-switch.css" rel="stylesheet">
  84. <script src="jquery.js"></script>
  85. <script src="bootstrap-switch.js"></script>
  86. [...]
  87. #options
  88. h1.page-header Options
  89. table.table.table-bordered.table-striped.table-responsive
  90. thead
  91. tr
  92. th Name
  93. th Type
  94. th Description
  95. th Values
  96. th Default
  97. tbody
  98. tr
  99. td state
  100. td Boolean
  101. td The checkbox state
  102. td true, false
  103. td 'checked' attribute or true
  104. tr
  105. td size
  106. td String
  107. td The checkbox state
  108. td 'mini', 'small', 'normal', 'large'
  109. td 'normal'
  110. tr
  111. td animate
  112. td Boolean
  113. td Animate the switch
  114. td true, false
  115. td true
  116. tr
  117. td disabled
  118. td Boolean
  119. td Disable state
  120. td true, false
  121. td 'disabled' attribute or false
  122. tr
  123. td readonly
  124. td Boolean
  125. td Readonly state
  126. td true, false
  127. td 'readonly' attribute or false
  128. tr
  129. td onColor
  130. td String
  131. td Color of the left side of the switch
  132. td 'primary', 'info', 'success', 'warning', 'danger', 'default'
  133. td 'primary'
  134. tr
  135. td offColor
  136. td String
  137. td Color of the right side of the switch
  138. td 'primary', 'info', 'success', 'warning', 'danger', 'default'
  139. td 'default'
  140. tr
  141. td onText
  142. td String
  143. td Text of the left side of the switch
  144. td String
  145. td 'ON'
  146. tr
  147. td offText
  148. td String
  149. td Text of the right side of the switch
  150. td String
  151. td 'OFF'
  152. tr
  153. td labelText
  154. td String
  155. td Text of the center handle of the switch
  156. td String
  157. td ' '
  158. tr
  159. td onInit
  160. td Function
  161. td Callback function to execute on initialization
  162. td Function
  163. td function(event) {}
  164. tr
  165. td onSwitchChange
  166. td Function
  167. td Callback function to execute on switch state change
  168. td Function
  169. td function(event, state) {}
  170. #methods
  171. h1.page-header Methods
  172. p In Bootstrap Switch, every option is also a method.
  173. p You can call a method in this way:
  174. pre: code $('input[name="my-checkbox"]').bootstrapSwitch('state', true);
  175. h2 Additional Methods
  176. table.table.table-bordered.table-striped.table-responsive
  177. thead
  178. tr
  179. th Name
  180. th Description
  181. tbody
  182. tr
  183. td toggleState
  184. td Toggle the switch state
  185. tr
  186. td toggleDisabled
  187. td Toggle the disabled state
  188. tr
  189. td toggleReadonly
  190. td Toggle the readonly state
  191. tr
  192. td destroy
  193. td Destroy the instance of Bootstrap Switch
  194. #events
  195. h1.page-header Events
  196. p You can register to the emitted events as follow:
  197. pre
  198. code
  199. | $('inputy[name="my-checkbox"]').on('switchChange.bootstrapSwitch', function(event, state) {
  200. | console.log(this); // DOM element
  201. | console.log(event); // jQuery event
  202. | console.log(state); // true | false
  203. | });
  204. table.table.table-bordered.table-striped.table-responsive
  205. thead
  206. tr
  207. th Name
  208. th Description
  209. th Parameters
  210. tbody
  211. tr
  212. td init
  213. td Triggered on initialization. 'this' refers to the DOM element.
  214. td
  215. | event <a href="https://api.jquery.com/category/events/event-object/" target="_blank">jQuery Event object</a>
  216. tr
  217. td switchChange
  218. td Triggered on switch state change. 'this' refers to the DOM element.
  219. td
  220. | event (<a href="https://api.jquery.com/category/events/event-object/" target="_blank">jQuery Event object</a>),
  221. | state (true | false)
  222. #examples
  223. h1.page-header Examples
  224. h2 State
  225. .row
  226. .col-sm-6
  227. input(type='checkbox', id='toggle-state-switch' checked)
  228. .col-sm-6
  229. .btn-group.pull-right
  230. button(type='button', id='toggle-state-switch-button-state', class='btn btn-default') Get State
  231. &nbsp;
  232. button(type='button', id='toggle-state-switch-button-on', class='btn btn-default') Set On
  233. &nbsp;
  234. button(type='button', id='toggle-state-switch-button-off', class='btn btn-default') Set Off
  235. &nbsp;
  236. button(type='button', id='toggle-state-switch-button', class='btn btn-default') Toggle State
  237. <p>Working on this...</p>
  238. script(src='docs/lib/js/jquery.min.js')
  239. script(src='docs/lib/js/bootstrap.min.js')
  240. script(src='docs/lib/js/highlight.js')
  241. script(src='build/js/bootstrap-switch.js')
  242. script(src='docs/index.js')