国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 開發(fā) > JS > 正文

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

2024-05-06 16:34:31
字體:
供稿:網(wǎng)友

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

按鈕插件

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

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

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

加載

通過data-loading-text屬性定義加載的文本信息,然后通過JavaScript給按鈕綁定一個(gè)事件,并給按鈕添加一個(gè)button(“loading”)方法來激活按鈕的加載狀態(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),實(shí)現(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í)有所幫助,也希望大家多多支持VeVb武林網(wǎng)。


注:相關(guān)教程知識閱讀請移步到JavaScript/Ajax教程頻道。
發(fā)表評論 共有條評論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 固阳县| 那坡县| 囊谦县| 遂川县| 孟津县| 绥德县| 鹿泉市| 车险| 丽水市| 珠海市| 福海县| 安远县| 淮南市| 呼玛县| 织金县| 利津县| 介休市| 拉萨市| 航空| 会理县| 天津市| 邵东县| 广德县| 永泰县| 上栗县| 安溪县| 徐汇区| 巴彦淖尔市| 泾源县| 油尖旺区| 宜良县| 红安县| 桂阳县| 微博| 广州市| 盐边县| 西藏| 扎赉特旗| 杭锦旗| 科技| 博客|