Converting checkboxes into Toggles with Bootstrap Toggle plugin
In this recipe, we will use the Bootstrap Toggle plugin, which has not been updated for over a year at the time of writing this book. The plugin is also intended to be used with Bootstrap 3. Luckily, it will not take us a lot of effort to adjust the behavior of this plugin to work with Bootstrap 4.
Getting ready
To begin this recipe, navigate to the Bootstrap Toggle plugin repository, available at https://github.com/minhur/bootstrap-toggle.
Specifically, we need two files from this repository:
- The plugin's CSS, available at https://github.com/minhur/bootstrap-toggle/blob/master/css/bootstrap-toggle.css
- The plugin's JS, available at https://github.com/minhur/bootstrap-toggle/blob/master/js/bootstrap-toggle.js
There is also a Bower installation available for this plugin, by running the bower install bootstrap-toggle
code (as described in the official plugin website, at http://www.bootstraptoggle.com).
How to do it…
- Copy the raw CSS code...