| 776 |
lars |
1 |
# Bootstrap Switch
|
|
|
2 |
[](https://david-dm.org/nostalgiaz/bootstrap-switch)
|
|
|
3 |
[](https://david-dm.org/nostalgiaz/bootstrap-switch#info=devDependencies)
|
|
|
4 |
[](https://www.npmjs.org/)
|
|
|
5 |
|
|
|
6 |
Turn checkboxes and radio buttons in toggle switches.
|
|
|
7 |
|
|
|
8 |
## Contribute
|
|
|
9 |
|
|
|
10 |
Hi, Emanuele here. I am currently the sole contributor of Bootstrap Switch and have been mantaining it for quite a considerable amount of time.
|
|
|
11 |
The development pace is strongly affected by the personal lack of time and a missing core team behind the project.
|
|
|
12 |
It would be nice to have someone available for clearing the list of open issues and occasionally implementing new functionalities.
|
|
|
13 |
If interest, you can drop me a line or pick a bug, kill it and open a Pull Request against `develop` branch.
|
|
|
14 |
Any contribution made after February 5th, 2015 is to be dual-licensed Apache and MIT, and thus, once all previous contributors agree, we will change the license to MIT (like Bootstrap did)
|
|
|
15 |
|
|
|
16 |
Many thanks.
|
|
|
17 |
|
|
|
18 |
## Demo and Documentation
|
|
|
19 |
|
|
|
20 |
- [Examples](http://www.bootstrap-switch.org/examples.html)
|
|
|
21 |
- [Options](http://www.bootstrap-switch.org/options.html)
|
|
|
22 |
- [Methods](http://www.bootstrap-switch.org/methods.html)
|
|
|
23 |
- [Events](http://www.bootstrap-switch.org/events.html)
|
|
|
24 |
|
|
|
25 |
## Getting started
|
|
|
26 |
|
|
|
27 |
Include the dependencies: jQuery, Bootstrap and Bootstrap Switch CSS + Javascript:
|
|
|
28 |
|
|
|
29 |
``` html
|
|
|
30 |
[...]
|
|
|
31 |
<link href="bootstrap.css" rel="stylesheet">
|
|
|
32 |
<link href="bootstrap-switch.css" rel="stylesheet">
|
|
|
33 |
<script src="jquery.js"></script>
|
|
|
34 |
<script src="bootstrap-switch.js"></script>
|
|
|
35 |
[...]
|
|
|
36 |
```
|
|
|
37 |
|
|
|
38 |
Add your checkbox:
|
|
|
39 |
|
|
|
40 |
```html
|
|
|
41 |
<input type="checkbox" name="my-checkbox" checked>
|
|
|
42 |
```
|
|
|
43 |
|
|
|
44 |
Initialize Bootstrap Switch on it:
|
|
|
45 |
|
|
|
46 |
```javascript
|
|
|
47 |
$("[name='my-checkbox']").bootstrapSwitch();
|
|
|
48 |
```
|
|
|
49 |
|
|
|
50 |
Enjoy.
|
|
|
51 |
|
|
|
52 |
## Less
|
|
|
53 |
|
|
|
54 |
If you want to use your bootstrap variables, include `bootstrap-switch.less` in your compilation stack. You can even choose among Bootstrap versions 2.3.2 or 3.*.* compatible source.
|
|
|
55 |
|
|
|
56 |
## AngularJs
|
|
|
57 |
|
|
|
58 |
Two custom directives are available:
|
|
|
59 |
- [angular-bootstrap-switch](https://github.com/frapontillo/angular-bootstrap-switch)
|
|
|
60 |
- [angular-toggle-switch](https://github.com/JumpLink/angular-toggle-switch)
|
|
|
61 |
|
|
|
62 |
## KnockoutJs
|
|
|
63 |
|
|
|
64 |
A Knockout binding handler is available [here](https://github.com/pauloortins/knockout-bootstrap-switch)
|
|
|
65 |
|
|
|
66 |
## NuGet
|
|
|
67 |
|
|
|
68 |
A NuGet package is available [here](https://github.com/blachniet/bootstrap-switch-nuget)
|
|
|
69 |
|
|
|
70 |
## Supported browsers
|
|
|
71 |
|
|
|
72 |
IE9+ and all the other modern browsers.
|
|
|
73 |
|
|
|
74 |
## License
|
|
|
75 |
|
|
|
76 |
Licensed under the Apache License, Version 2.0
|
|
|
77 |
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
78 |
|
|
|
79 |
We are in the process of changing from Apache to MIT. If you contributed before February 5th, 2015, please add your vote here to accept license change: https://github.com/nostalgiaz/bootstrap-switch/issues/347
|