尺寸(Size)
颜色(Colors)
动画(Animation)
禁用(Disabled)
文本(Text)
HTML文本(HTML text)
<div class="switch" data-on-label="<i class='icon-ok icon-white'></i>" data-off-label="<i class='icon-remove'></i>">
<input type="checkbox" checked />
</div>
事件处理(Event handler) javascript
$('#mySwitch').on('switch-change', function (e, data) {
var $el = $(data.el)
, value = data.value;
console.log(e, $el, value);
});
Toggle State javascript
$('#toggle-state-switch').bootstrapSwitch('toggleState');
$('#toggle-state-switch').bootstrapSwitch('setState', false); // true || false
销毁(Destroy) javascript
$('#destroy-switch').bootstrapSwitch('destroy');
创建(Create) javascript
$('#create-switch').wrap('<div class="switch" />').parent().bootstrapSwitch();
禁用(Disabled) javascript
$('#disable-switch').bootstrapSwitch('isActive');
$('#disable-switch').bootstrapSwitch('toggleActivation');
$('#disable-switch').bootstrapSwitch('setActive', false); // true || false