index.jade 8.9 KB

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