示例代码:

    var elems = Array.prototype.slice.call(document.querySelectorAll('.js-switch_2'));
elems.forEach(function(html) {
var switchery = new Switchery(html, { color: '#ED5565' });
});
$('.js-switch_2').change(function(){
alert($(this).prop("checked"));
});

插件地址:http://abpetkov.github.io/switchery/

Related Posts: jQuery-checkbox-Switchery-变更时响应 :