Smooth Animated Toggle Control Plugin With jQuery Bootstrap Bootstrap Toggle - Free Download Smooth Animated Toggle Control Plugin With jQuery and Bootstrap - Bootstrap Toggle

Free Download Smooth Animated Toggle Control Plugin With jQuery and Bootstrap – Bootstrap Toggle

Posted on

This time I will share jQuery Plugin and tutorial about Smooth Animated Toggle Control Plugin With jQuery and Bootstrap – Bootstrap Toggle, hope it will help you in programming stack.

Smooth Animated Toggle Control Plugin With jQuery Bootstrap Bootstrap Toggle - Free Download Smooth Animated Toggle Control Plugin With jQuery and Bootstrap - Bootstrap Toggle
File Size: 124 KB
Views Total: 6969
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   

Bootstrap Toggle is a jQuery plugin that turns the checboxes into animated and highly customizable toggle controls based on templates with Bootstrap 3 and 4.

The Bootstrap 4 Version is available here.

Basic Usage:

1. Load jQuery library and Twitter’s Bootstrap framework in the Html page.

1 <link rel="stylesheet" href="bootstrap.min.css">
2 <script src="bootstrap.min.js"></script>
3 <script src="jquery.min.js"></script>

2. Load the jQuery Bootstrap toggle plugin’s stylesheet and Javascript in the page. 

1 <link href="css/bootstrap-toggle.css" rel="stylesheet">
2 <script src="js/bootstrap-toggle.js"></script>

3. Create a normal checbox input with the data-toggle="toggle" attribute for auto initialization.

1 <input type="checkbox" checked data-toggle="toggle">

4. You can also initialize the plugin in the Javascript.

1 $(function() {
2   $('input[type="checkbox"]').bootstrapToggle();
3 })

5. Override the following settings during initialization. You can also pass them using Html5 data-* attributes embedded in the input tag.

01 // Text of the on toggle
02 on: 'On',
03  
04 // Text of the off toggle
05 off: 'Off',
06  
07 // Style of the on toggle. Possible values are:
08 // default, primary, success, info, warning, danger
09 onstyle: 'primary',
10  
11 // Style of the off toggle. Possible values are:
12 // default, primary, success, info, warning, danger
13 offstyle: 'default',
14  
15 // Sizeof the off toggle. Possible values are:
16 // default, mini, small, large, normal
17 size: 'normal',
18  
19 // Custom styles
20 style: ''

6. Public methods.

01 // Initializes the plugin with options
02 $('input[type="checkbox"]').bootstrapToggle()
03  
04 // Destroys the toggle
05 $('input[type="checkbox"]').bootstrapToggle('destroy')
06  
07 // Sets the toggle to 'On' state
08 $('input[type="checkbox"]').bootstrapToggle('on')
09  
10 // Sets the toggle to 'Off' state
11 $('input[type="checkbox"]').bootstrapToggle('off'
12  
13 // Toggles the state of the toggle
14 $('input[type="checkbox"]').bootstrapToggle('toggle')
15  
16 // Enables the toggle
17 $('input[type="checkbox"]').bootstrapToggle('enable')
18  
19 // Disables the toggle
20 $('input[type="checkbox"]').bootstrapToggle('disable')

Changelog:

2020-02-16

  • Added Bootstrap 4 version.

This awesome jQuery plugin is developed by gitbrent. For more Advanced Usages, please check the demo page or visit the official website.

source : jquery.net