Turn checkboxes and radio buttons in toggle switches.
fork from : https://github.com/Bttstrp/bootstrap-switch.git

t3chn0r d8050f5317 Update static/js/jquery.switch.js 12 năm trước cách đây
examples 5c8673caa3 add label doc to site 12 năm trước cách đây
static d8050f5317 Update static/js/jquery.switch.js 12 năm trước cách đây
.gitignore 40c9d7eb1d welcome 12 năm trước cách đây
LICENSE 40c9d7eb1d welcome 12 năm trước cách đây
README.md 5c28e9d109 update doc 12 năm trước cách đây

README.md

Bootstrap-switch

Demo

http://www.larentis.eu/switch/

Usage

Just include Twitter Bootstrap, jQuery, Bootstrap Switch CSS and Javascript

<link href="http://twitter.github.com/bootstrap/assets/css/bootstrap.css" rel="stylesheet">
<link href="bootstrap-switch.css" rel="stylesheet">

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
<script src="jquery.switch.js"></script>

Basic Example

<div class="switch">
    <input type="checkbox">
</div>

Large, small or mini

<div class="switch switch-large">  <!-- switch-large, switch-small or switch-mini -->
    <input type="checkbox">
</div>

Colors

<div class="switch" data-on="danger" data-off="warning">  <!-- primary, info, success, warning and danger -->
    <input type="checkbox">
</div>

Animation

<div class="switch" data-animated="false">
    <input type="checkbox">
</div>

Label

<div class="switch" data-on-label="SI" data-off-label="NO">
    <input type="checkbox">
</div>

Initial values

<div class="switch">
    <input type="checkbox" checked="checked" disabled="disabled">
</div>

Event handler

$('#mySwitch').on('switch-change', function (e, data) {
    var $el = $(data.el)
      , value = data.value;
    console.log(e, $el, value);
});

Methods

$('#mySwitch').switch('toggleActivation');
$('#mySwitch').switch('toggleState');
$('#mySwitch').switch('setState', true);
$('#mySwitch').switch('status');  // returns true or false
$('#mySwitch').switch('destroy');