You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Fork the repository and checkout `master` branch
8
-
-Run `npm install` to get or update the dependencies
9
-
-Run `npm start` to build `dist/` and `docs/` directories
10
-
- Change JavaScript or LESS files in `src/`directories
11
-
- Do not commit changes to dist/ or docs/. These will only be built on merge.
12
-
- Once finished, submit a [Pull Request](https://github.com/nostalgiaz/bootstrap-switch/compare/master...master). Remember to target `master` as destination branch
10
+
-Install or update dependencies running `yarn`
11
+
-Build `dist/` and `docs/` directories running `yarn start`
12
+
- Change files in `src/`directory
13
+
- Do *not* change any files inside `dist/` or `docs/`. These are automatically generated on merge.
14
+
- Once finished, submit a [Pull Request](https://github.com/Bttstrp/bootstrap-switch/compare/master...master). Remember to target `master` as destination branch
Turn checkboxes and radio buttons into toggle switches. Created by [Mattia Larentis](http://github.com/nostalgiaz), maintained by [Emanuele Marchi](http://github.com/lostcrew) and [Peter Stein](http://www.bdmdesign.org) with the help of the community.
7
-
Compatible with Bootstrap 4, Bootstrap 3 and Bootstrap 2.
7
+
- Turn checkboxes and radio buttons into toggle switches.
8
+
- Compatible with Bootstrap versions 4, 3 and 2 (legacy).
9
+
- Use with or without bundlers/build tools
10
+
- Supports IE9+ and all the other modern browsers.
Play with [demo on my fiddle](https://jsfiddle.net/djibe89/vL87w0j8/).
25
+
You can also install it manually by downloading the [latest release](https://github.com/Bttstrp/bootstrap-switch/releases/latest) or clone the repo: `git clone https://github.com/Bttstrp/bootstrap-switch.git`.
26
+
27
+
### Inclusion
28
+
29
+
#### With build tools
30
+
31
+
If you use a bundler (Webpack, Rollup, Parcel…) or a task runner (Gulp, Grunt…) that supports SASS (or LESS, for Boostrap 3 or 2) and the JS module syntax, include the appropriate entry point file:
- Download the [latest release](https://github.com/Bttstrp/bootstrap-switch/releases/latest)
16
-
- Clone the repo: `git clone https://github.com/Bttstrp/bootstrap-switch.git`
17
-
- Install with npm: `npm install bootstrap-switch`
18
-
- Install with yarn: `yarn add bootstrap-switch`
19
-
- Install with Composer: `composer require components/bootstrap-switch`
20
-
- Install with Bower: `bower install bootstrap-switch`
21
-
- Install with NuGet: `PM> Install-Package Bootstrap.Switch` ([NuGet package](https://github.com/blachniet/bootstrap-switch-nuget))
48
+
#### Without build tools
22
49
23
-
Include the dependencies: jQuery, Bootstrap and Bootstrap Switch CSS + Javascript:
50
+
Include the dependences (jQuery, Bootstrap) and the already compiled JavaScript and CSS files in your HTML:
24
51
25
-
```html
52
+
```html
53
+
<!-- somewhere in <head> tag -->
26
54
<linkhref="bootstrap.css"rel="stylesheet">
27
55
<linkhref="bootstrap-switch.css"rel="stylesheet">
28
56
<scriptsrc="jquery.js"></script>
29
57
<scriptsrc="bootstrap-switch.js"></script>
30
58
```
31
59
32
-
Add your checkbox:
60
+
### Your first switch
61
+
62
+
Add a checkbox:
33
63
34
64
```html
35
65
<inputtype="checkbox"name="my-checkbox"checked>
36
66
```
37
67
38
-
Initialize Bootstrap Switch on it:
68
+
Finally, initialize Bootstrap Switch on it:
39
69
40
70
```javascript
41
71
$("[name='my-checkbox']").bootstrapSwitch();
42
72
```
43
73
44
-
Enjoy.
45
-
46
-
## Supported browsers
47
-
48
-
IE9+ and all the other modern browsers.
49
-
50
-
## LESS
51
-
52
-
- For Bootstrap 2 (no longer officially supported), import `src/less/bootstrap2/bootstrap-switch.less`
53
-
- For Bootstrap 3, import `src/less/bootstrap3/bootstrap-switch.less`
54
-
55
-
## SASS/SCSS
56
-
57
-
- For Bootstrap 4, import `src/sass/bootstrap4/bootstrap-switch.scss`
74
+
Profit!
58
75
59
76
## Bugs and feature requests
60
77
@@ -79,3 +96,6 @@ Please do not use the issue tracker for personal support requests: [Stack Overfl
79
96
80
97
Licensed under the [MIT License](https://github.com/Bttstrp/bootstrap-switch/blob/master/LICENSE).
81
98
99
+
## Credits
100
+
101
+
Created by [Mattia Larentis](http://github.com/nostalgiaz). Maintained by [Emanuele Marchi](http://github.com/lostcrew), [Martin Hradil](https://github.com/himdel). Formerly maintained by [Thomas Grainger](https://github.com/graingert) and [Peter Stein](http://www.bdmdesign.org). Forever supported by the generosity of this community.
0 commit comments