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

bootstrap按鈕插件(Button)使用方法解析

 更新時間:2017年01月13日 11:19:05   投稿:lijiao  
這篇文章主要為大家詳細(xì)解析了bootstrap按鈕插件Button使用方法,具有一定的參考價值,感興趣的小伙伴們可以參考一下

按鈕插件(Button)學(xué)習(xí)筆記:

按鈕插件

樣式文件:
☑ LESS版本:源文件buttons.less

☑ 點(diǎn)擊按鈕時,按鈕文字變?yōu)椤罢诩虞d…”,一旦加載完之后又變回“獲取數(shù)據(jù)”。簡單點(diǎn)說就是控制按鈕狀態(tài),比如禁用狀態(tài)、正在加載狀態(tài)、正常狀態(tài)等;
☑ 按鈕切換狀態(tài)
☑ 按鈕模仿單選按鈕
☑ 按鈕模仿復(fù)選按鈕

按鈕插件–按鈕加載狀態(tài)
通過按鈕可以設(shè)計狀態(tài)提示,當(dāng)單擊按鈕時,會顯示loading狀態(tài)信息。例如,點(diǎn)擊“加載”按鈕,會觸發(fā)按鈕的加載的狀態(tài)

加載

通過data-loading-text屬性定義加載的文本信息,然后通過JavaScript給按鈕綁定一個事件,并給按鈕添加一個button(“l(fā)oading”)方法來激活按鈕的加載狀態(tài)行為。如下所示:

$(function(){
 $("#loaddingBtn").click(function () {
  $(this).button("loading");
  });
});

按鈕插件–模擬單選擇按鈕

在Bootstrap框架中按鈕插件中,可以通過給按鈕組自定義屬性data-toggle=”buttons”

<div class="btn-group">
 <label class="btn btn-primary">
  <input type="radio" name="options" id="options1">男
 </label>
 <label class="btn btn-primary">
  <input type="radio" name="options" id="options2">女
 </label>
 <label class="btn btn-primary">
  <input type="radio" name="options" id="options3">未知
 </label>
</div>
----------------------------------------------------------------------
<div class="btn-group" data-toggle="buttons">
 <label class="btn btn-primary">
  <input type="radio" name="options" id="options1">男
 </label>
 <label class="btn btn-primary">
  <input type="radio" name="options" id="options2">女
 </label>
 <label class="btn btn-primary">
  <input type="radio" name="options" id="options3">未知
 </label>
</div>

按鈕插件–模擬復(fù)選按鈕

<div class="btn-group">
 <label class="btn btn-primary">
  <input type="checkbox" name="options" id="options1">電影
 </label>
 <label class="btn btn-primary">
  <input type="checkbox" name="options" id="options2">音樂
 </label>
 <label class="btn btn-primary">
  <input type="checkbox" name="options" id="options3">游戲
 </label>
 <label class="btn btn-primary">
  <input type="checkbox" name="options" id="options4">攝影
 </label>
</div>
-------------------------------------------------------------------
<div class="btn-group" data-toggle="buttons">
 <label class="btn btn-primary">
  <input type="checkbox" name="options" id="options1">電影
 </label>
 <label class="btn btn-primary">
  <input type="checkbox" name="options" id="options2">音樂
 </label>
 <label class="btn btn-primary">
  <input type="checkbox" name="options" id="options3">游戲
 </label>
 <label class="btn btn-primary">
  <input type="checkbox" name="options" id="options4">攝影
 </label>
</div>

按鈕插件–按鈕狀態(tài)切換

使用 data-toggle 屬性還可以激活按鈕的行為狀態(tài),實現(xiàn)在激活和未激活之間進(jìn)行狀態(tài)切換。

<button type="button" data-toggle="button" class="btn btn-primary">確認(rèn)</button>

按鈕插件–JavaScript用法

1、切換按鈕狀態(tài)(得到焦點(diǎn))

$("#mybutton").button("toggle")

2、重新恢復(fù)按鈕:

$("#mybutton").button("reset")

3、任意參數(shù):

$(“#mybutton”).button(“任意字符參數(shù)名”)

替換 data-任意字符參數(shù)名-text 的屬性值為“按鈕上顯示的文本值”

以上就是本文的全部內(nèi)容,希望對大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。

相關(guān)文章

最新評論