详解Bootstrap的iCheck插件checkbox和radio iCheck
特⾊:
1、在不同浏览器(包括ie6+)和设备上都有相同的表现 — 包括桌⾯和移动设备
2、⽀持触摸设备 — iOS、Android、BlackBerry、Windows Phone等系统
4、⽅便定制 — ⽤HTML 和 CSS 即可为其设置样式 (多套⽪肤)
5、体积⼩巧 — gzip压缩后只有1 kb
6、25 种参数⽤来定制复选框(checkbox)和单选按钮(radio button)
7、8 个回调事件⽤来监听输⼊框的状态
8、7个⽅法⽤来通过编程⽅式控制输⼊框的状态
9、能够将输⼊框的状态变化同步回原始输⼊框中,⽀持所有选择器
使⽤⽅法:
c语言rand函数范围
$('input').iCheck('check'); //将输⼊框的状态设置为checked
转发重定向$('input').iCheck('uncheck'); //移除 checked 状态
$('input').iCheck('toggle'); //toggle checked state
$('input').iCheck('disable'); //将输⼊框的状态设置为 disabled
$('input').iCheck('enable'); //移除 disabled 状态
$('input').iCheck('update'); //apply input changes, which were done outside the plugin
$('input').iCheck('destroy'); //移除iCheck样式
调⽤iCheck时,只需要将修改了默认值的参数列出来即可:
//基础使⽤⽅法
$('input').iCheck({
labelHover : false,
cursor : true,
checkboxClass : 'icheckbox_square-blue',
radioClass : 'iradio_square-blue',
increaseArea : '20%'
});
下⾯是参数列表及其默认值:
{
handle: '',
checkboxClass: 'icheckbox',若依flowable
radioClass: 'iradio',
checkedClass: 'checked',
checkedCheckboxClass: '',jquery下载文件插件
checkedRadioClass: '',
uncheckedClass: '',
uncheckedCheckboxClass: '',
uncheckedRadioClass: '',
disabledClass: 'disabled',
disabledCheckboxClass: '',
disabledRadioClass: '',
enabledClass: '',
enabledCheckboxClass: '',
enabledRadioClass: '',
hoverClass: 'hover',
focusClass: 'focus',
marquee boost低帮测评activeClass: 'active',
labelHover: true,
labelHoverClass: 'hover',
increaseArea: '',
cursor: false,
inheritClass: false,
inheritID: false,
insert: ''
}
我们可以对上⾯列出的任何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 //紫⾊
(请⾃⾏下载这些⽪肤包)
初始化
⾸先,引⼊jQuery库⽂件
其次,引⼊jquery.icheck.js插件⽂件
(如果要引⼊相关⽪肤,则需引⼊:相关主题颜⾊.css⽂件)
回调事件
iCheck⽀持所有选择器(selectors),并且只针对复选框checkbox和单选radio按钮起作⽤
iCheck提供了⼤量回调事件,都可以⽤来监听change事件tcp ip协议就是指传输控制协议 网际协议
使⽤on()⽅法绑定事件:
$('input').on('ifChecked', function(event){ //ifCreated 事件应该在插件初始化之前绑定
pe + ' callback');
});
bootstrap iCheck中的radio和checkbox的⼤⼩可以调整吗?
.icheckbox_square-blue, .iradio_square-blue {
display: block;
margin: 0;
padding: 0;
width: 22px;
height: 22px;
background: url(blue.png) no-repeat;
border: none;
cursor: pointer;
}
如果要调整icheck的radio或checkbox样式,通过上⾯的css修改width和height,同时修改blue.png图⽚对应的尺⼨。
下⾯看下bootstrap icheck 如何获取radio的value值
针对下⾯⼀组radio,在使⽤icheck的时候怎么才能获取到value值 1或 0呢?
以上所述是⼩编给⼤家介绍的Bootstrap的iCheck插件checkbox和radio,希望对⼤家有所帮助,如果⼤家有任何疑问请给我留⾔,⼩编会及时回复⼤家的。在此也⾮常感谢⼤家对⽹站的⽀持!

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。