欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

詳解Bootstrap的iCheck插件checkbox和radio

 更新時間:2016年08月24日 10:20:38   作者:bbsyi  
這篇文章主要詳細介紹了Bootstrap的iCheck插件checkbox和radio的知識及bootstrap icheck獲取radio的value值的方法,非常不錯,具有參考借鑒價值,感興趣的朋友一起看下吧

iCheck

特色:

1、在不同瀏覽器(包括ie6+)和設(shè)備上都有相同的表現(xiàn) — 包括 桌面和移動設(shè)備

2、支持觸摸設(shè)備 — iOS、Android、BlackBerry、Windows Phone等系統(tǒng)

4、方便定制 — 用HTML 和 CSS 即可為其設(shè)置樣式 (多套皮膚)

5、體積小巧 — gzip壓縮后只有1 kb

6、25 種參數(shù) 用來定制復(fù)選框(checkbox)和單選按鈕(radio button)

7、8 個回調(diào)事件 用來監(jiān)聽輸入框的狀態(tài)

8、7個方法 用來通過編程方式控制輸入框的狀態(tài)

9、能夠?qū)⑤斎肟虻臓顟B(tài)變化同步回原始輸入框中, 支持所有選擇器

使用方法:

$('input').iCheck('check'); //將輸入框的狀態(tài)設(shè)置為checked
$('input').iCheck('uncheck'); //移除 checked 狀態(tài)
$('input').iCheck('toggle'); //toggle checked state
$('input').iCheck('disable'); //將輸入框的狀態(tài)設(shè)置為 disabled
$('input').iCheck('enable'); //移除 disabled 狀態(tài)
$('input').iCheck('update'); //apply input changes, which were done outside the plugin
$('input').iCheck('destroy'); //移除iCheck樣式

調(diào)用iCheck時,只需要將修改了默認值的參數(shù)列出來即可:

//基礎(chǔ)使用方法 
$('input').iCheck({ 
labelHover : false, 
cursor : true, 
checkboxClass : 'icheckbox_square-blue', 
radioClass : 'iradio_square-blue', 
increaseArea : '20%' 
});

下面是參數(shù)列表及其默認值:

{ 
handle: '', 
checkboxClass: 'icheckbox', 
radioClass: 'iradio', 
checkedClass: 'checked', 
checkedCheckboxClass: '', 
checkedRadioClass: '', 
uncheckedClass: '', 
uncheckedCheckboxClass: '', 
uncheckedRadioClass: '', 
disabledClass: 'disabled', 
disabledCheckboxClass: '', 
disabledRadioClass: '', 
enabledClass: '', 
enabledCheckboxClass: '', 
enabledRadioClass: '', 
hoverClass: 'hover', 
focusClass: 'focus', 
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插件文件

(如果要引入相關(guān)皮膚,則需引入:相關(guān)主題顏色.css文件)

回調(diào)事件

iCheck支持所有選擇器(selectors),并且只針對復(fù)選框checkbox和單選radio按鈕起作用

iCheck提供了大量回調(diào)事件,都可以用來監(jiān)聽change事件

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

$('input').on('ifChecked', function(event){ //ifCreated 事件應(yīng)該在插件初始化之前綁定 
 alert(event.type + ' callback'); 
}); 
bootstrap iCheck中的radio和checkbox的大小可以調(diào)整嗎?
.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; 
} 

如果要調(diào)整icheck的radio或checkbox樣式,通過上面的css修改width和height,同時修改blue.png圖片對應(yīng)的尺寸。

下面看下bootstrap icheck 如何獲取radio的value值

針對下面一組radio,在使用icheck的時候怎么才能獲取到value值 1或 0呢?

以上所述是小編給大家介紹的Bootstrap的iCheck插件checkbox和radio,希望對大家有所幫助,如果大家有任何疑問請給我留言,小編會及時回復(fù)大家的。在此也非常感謝大家對腳本之家網(wǎng)站的支持!

相關(guān)文章

最新評論