leaves note

write by a programer

 
  1. $('input').iCheck('check');   //将输入框的状态设置为checked 

  2. $('input').iCheck('uncheck'); //移除 checked 状态 

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

  4. $('input').iCheck('disable'); //将输入框的状态设置为 disabled 

  5. $('input').iCheck('enable');  //移除 disabled 状态 

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

  7. $('input').iCheck('destroy'); //移除iCheck样式 

调用iCheck时,只需要将修改了默认值的参数列出来即可:

 

  1. //基础使用方法 

  2. $('input').iCheck({ 

  3.   labelHover : false, 

  4.   cursor : true, 

  5.   checkboxClass : 'icheckbox_square-blue', 

  6.   radioClass : 'iradio_square-blue', 

  7.   increaseArea : '20%' 

  8. }); 

下面是参数列表及其默认值:

 

  1. { 

  2.  handle: '', 

  3.  checkboxClass: 'icheckbox', 

  4.  radioClass: 'iradio', 

  5.  checkedClass: 'checked', 

  6.  checkedCheckboxClass: '', 

  7.  checkedRadioClass: '', 

  8.  uncheckedClass: '', 

  9.  uncheckedCheckboxClass: '', 

  10.  uncheckedRadioClass: '', 

  11.  disabledClass: 'disabled', 

  12.  disabledCheckboxClass: '', 

  13.  disabledRadioClass: '', 

  14.  enabledClass: '', 

  15.  enabledCheckboxClass: '', 

  16.  enabledRadioClass: '', 

  17.  hoverClass: 'hover', 

  18.  focusClass: 'focus', 

  19.  activeClass: 'active', 

  20.  labelHover: true, 

  21.  labelHoverClass: 'hover', 

  22.  increaseArea: '', 

  23.  cursor: false, 

  24.  inheritClass: false, 

  25.  inheritID: false, 

  26.  insert: '' 

  27. } 

我们可以对上面列出的任何class重置样式

 

皮肤

Black — minimal.css  //黑色

Red — red.css  //红色

Green — green.css  //绿色

Blue — blue.css  //蓝色

Aero — aero.css //win7中的那种玻璃效果

Grey — grey.css  //银灰色

Orange — orange.css  //橙色

Yellow — yellow.css  //黄色

Pink — pink.css  //粉红色

Purple — purple.css  //紫色

 
 事件名称 使用时机
 ifClicked 用户点击了自定义的输入框或与其相关联的label
 ifChanged 输入框的 checked 或 disabled 状态改变了
 ifChecked 输入框的状态变为 checked
 ifUnchecked checked 状态被移除
 ifDisabled 输入框状态变为 disabled
 ifEnabled disabled 状态被移除
 ifCreated 输入框被应用了iCheck样式
 ifDestroyed iCheck样式被移除

 使用on()方法绑定事件:

  1. $('input').on('ifChecked', function(event){ //ifCreated 事件应该在插件初始化之前绑定 

  2.   alert(event.type + ' callback'); 

  3. }); 

bootstrap iCheck中的radio和checkbox的大小可以调整吗?

  1. .icheckbox_square-blue, .iradio_square-blue { 

  2.   display: block; 

  3.   margin: 0; 

  4.   padding: 0; 

  5.   width: 22px; 

  6.   

    上一篇: PHP post数据接收