作为程序员一定要保持良好的睡眠,才能好编程

iCheck插件的使用

发布时间:2019-01-09



icheck相关使用方法

Methods

// change input's state to 'checked'
$('input').iCheck('check');

// remove 'checked' state
$('input').iCheck('uncheck');

// toggle 'checked' state
$('input').iCheck('toggle');

// change input's state to 'disabled'
$('input').iCheck('disable');

// remove 'disabled' state
$('input').iCheck('enable');

// change input's state to 'indeterminate'
$('input').iCheck('indeterminate');

// remove 'indeterminate' state
$('input').iCheck('determinate');

// apply input changes, which were done outside the plugin
$('input').iCheck('update');

// remove all traces of iCheck
$('input').iCheck('destroy');


还可以使用一个回调函数:

$('input').iCheck('check', function(){
  alert('Well done, Sir');
});


我提供一个我在项目中应用:


先看看截图吧:

icheck2.png

icheck.png




如何初始化:

$('.skin-minimal input').iCheck({
    checkboxClass: 'icheckbox-blue',
    radioClass: 'iradio-blue',
    increaseArea: '20%'
});


如何关联选中

$(document).on('ifChecked', '.permission-list2 dt input', function (event) {
    $(this).parent().parent().parent().parent().find('dd input[type="checkbox"]').iCheck('check');
});


如何批量取消

$(document).on('ifUnchecked', '.permission-list2 dt input', function (event) {
    $(this).parent().parent().parent().parent().find('dd input[type="checkbox"]').iCheck('uncheck');
});


还有其他的事件:


icheckcall.png


iCheck插件可以 美化页面的 radio  和 check  



这是github 上 icheck相关使用文档

https://github.com/fronteed/iCheck


更多使用详情,请查看 github上的帮助文档