ichecked 全选、反选

时间:2023-03-09 23:03:28
ichecked  全选、反选
//iChecked复选框的全选、反选
var checkBox =function (checkParents){
$(checkParents).find('.minimalCheckBox1').on('ifChanged',function(){
var _this = $(this);
var _thisParents =$(this).parents(checkParents);
var checkBoxSize =_thisParents.find('.minimalCheckBox1').filter(':not(:checked)').size();
if( checkBoxSize<= 0){
//如果其它的复选框全部被勾选了,那么全选勾中
_thisParents.find('.minimalCheckBox').iCheck('check');
}else{
_thisParents.find('.minimalCheckBox').iCheck('uncheck');
}
});
$('.minimalCheckBox').on('ifClicked', function(event){
var _this = $(this);
var _thisParents =$(this).parents(checkParents);
if(_this.is(':checked')){
//反选
_thisParents.find('.minimalCheckBox1').iCheck('uncheck');
}else {
//全选
_thisParents.find('.minimalCheckBox1').iCheck('check');
}
});
};