国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

首頁 web前端 js教程 Bootstrap下拉插件dropdown使用技巧

Bootstrap下拉插件dropdown使用技巧

Apr 16, 2018 pm 04:54 PM
bootstrap 使用技巧

這次帶給大家Bootstrap下拉外掛dropdown使用技巧,Bootstrap下拉外掛dropdown使用的注意事項(xiàng)有哪些,以下就是實(shí)戰(zhàn)案例,一起來看一下。

下拉式選單.dropdown具體用法

.dropdown <下拉選單觸發(fā)器button 下拉選單ul>

# .dropdown?包裹層

# .dropdown-toggle 下拉選單觸發(fā)器

data-toggle="dropdown? 自訂屬性 可以與js關(guān)聯(lián)起來

# .dropdown-menu? 下拉選單

具體實(shí)例:

<p class="dropdown">
?<button class="btn btn-default dropdown-toggle" type="button" id="dropdownMenu1" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
??Dropdown
??<span class="caret"></span>
?</button>
?<ul class="dropdown-menu" aria-labelledby="dropdownMenu1">
??<li><a href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >Action</a></li>
??<li><a href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >Another?action</a></li>
??<li><a href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >Something?else?here</a></li>
??<li role="separator" class="pider"></li>
??<li><a href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >Separated?link</a></li>
?</ul>
</p>

如果你想讓選單預(yù)設(shè)是開啟狀態(tài),需要加入一個(gè).open的類別

<p class="dropdown open">
?<button class="btn btn-default dropdown-toggle" type="button" id="dropdownMenu1" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
??Dropdown
??<span class="caret"></span>
?</button>
?<ul class="dropdown-menu" aria-labelledby="dropdownMenu1">
??<li><a href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >Action</a></li>
??<li><a href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >Another?action</a></li>
??<li><a href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >Something?else?here</a></li>
??<li role="separator" class="pider"></li>
??<li><a href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >Separated?link</a></li>
?</ul>
</p>

.dropup?? 向上彈出式選單

透過為下拉式選單的父元素設(shè)定 .dropup 類,可以讓選單向上彈出(預(yù)設(shè)是向下彈出的)

<p class="dropup">
?<button class="btn btn-default dropdown-toggle" type="button" id="dropdownMenu2" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
??Dropup
??<span class="caret"></span>
?</button>
?<ul class="dropdown-menu" aria-labelledby="dropdownMenu2">
??<li><a href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >Action</a></li>
??<li><a href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >Another?action</a></li>
??<li><a href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >Something?else?here</a></li>
??<li role="separator" class="pider"></li>
??<li><a href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >Separated?link</a></li>
?</ul>
</p>

1.對(duì)齊方式:預(yù)設(shè)左對(duì)齊

# 右對(duì)準(zhǔn):為.dropdown-menu加上.dropdown-menu-right類別就可以

# 注意:它是以父級(jí)的位置來對(duì)齊的

怎麼樣讓下拉式選單以下拉選單觸發(fā)器的右端對(duì)齊呢?那就需要為下拉式選單觸發(fā)器button新增一個(gè).btn block的類別

<p class="dropup">
?<button class="btn btn-default dropdown-toggle btn-block" type="button" id="dropdownMenu2" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
??Dropup
??<span class="caret"></span>
?</button>
?<ul class="dropdown-menu dropdown-menu-right " aria-labelledby="dropdownMenu2">
??<li><a href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >Action</a></li>
??<li><a href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >Another?action</a></li>
??<li><a href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >Something?else?here</a></li>
??<li role="separator" class="pider"></li>
??<li><a href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >Separated?link</a></li>
?</ul>
</p>

2.下拉式選單的標(biāo)題???? dropdown-header

在任何下拉式選單中均可透過新增標(biāo)題來標(biāo)明一組動(dòng)作。

如果想要讓下拉式選單的標(biāo)題居中,就需要加入一個(gè).text-center的類別

<ul class="dropdown-menu" aria-labelledby="dropdownMenu3">
?...
?<li class="dropdown-header text-center">Dropdown?header</li>
?...
</ul>

3.分割線:???? .pider?

為下拉式選單新增一條分割線,用於將多個(gè)連結(jié)分組。

<ul class="dropdown-menu" aria-labelledby="dropdownMenupider">
?...
?<li role="separator" class="pider"></li>
?...
</ul>

4、停用選單:disabled

# 為下拉式選單中的

  • 元素新增 .disabled 類,從而停用對(duì)應(yīng)的選單項(xiàng)目。

    <ul class="dropdown-menu" aria-labelledby="dropdownMenu4">
    ?<li><a href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >Regular?link</a></li>
    ?<li class="disabled"><a href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >Disabled?link</a></li>
    ?<li><a href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >Another?link</a></li>
    </ul>

    注意:

    aria-haspopup="true" ?aria-expanded="true"? 為需要藉助螢?zāi)婚喿x器的特殊人群設(shè)定的

    id="dropdownMenu1"?aria-labelledby="dropdownMenu1"?? 透過id將觸發(fā)器和下拉選單關(guān)聯(lián)起來 ? ? ? ? ? ? ? ? ? ? ? ??

    相信看了本文案例你已經(jīng)掌握了方法,更多精彩請關(guān)注php中文網(wǎng)其它相關(guān)文章!

    推薦閱讀:

    Bootrap Vue實(shí)作仿百度搜尋介面功能

    Node.js環(huán)境變數(shù)process.env使用詳解

    node.js和ES6的exports、module.exports使用詳解

    ##

    以上是Bootstrap下拉插件dropdown使用技巧的詳細(xì)內(nèi)容。更多資訊請關(guān)注PHP中文網(wǎng)其他相關(guān)文章!

  • 本網(wǎng)站聲明
    本文內(nèi)容由網(wǎng)友自願(yuàn)投稿,版權(quán)歸原作者所有。本站不承擔(dān)相應(yīng)的法律責(zé)任。如發(fā)現(xiàn)涉嫌抄襲或侵權(quán)的內(nèi)容,請聯(lián)絡(luò)admin@php.cn

    熱AI工具

    Undress AI Tool

    Undress AI Tool

    免費(fèi)脫衣圖片

    Undresser.AI Undress

    Undresser.AI Undress

    人工智慧驅(qū)動(dòng)的應(yīng)用程序,用於創(chuàng)建逼真的裸體照片

    AI Clothes Remover

    AI Clothes Remover

    用於從照片中去除衣服的線上人工智慧工具。

    Clothoff.io

    Clothoff.io

    AI脫衣器

    Video Face Swap

    Video Face Swap

    使用我們完全免費(fèi)的人工智慧換臉工具,輕鬆在任何影片中換臉!

    熱工具

    記事本++7.3.1

    記事本++7.3.1

    好用且免費(fèi)的程式碼編輯器

    SublimeText3漢化版

    SublimeText3漢化版

    中文版,非常好用

    禪工作室 13.0.1

    禪工作室 13.0.1

    強(qiáng)大的PHP整合開發(fā)環(huán)境

    Dreamweaver CS6

    Dreamweaver CS6

    視覺化網(wǎng)頁開發(fā)工具

    SublimeText3 Mac版

    SublimeText3 Mac版

    神級(jí)程式碼編輯軟體(SublimeText3)

    vue中怎麼用bootstrap vue中怎麼用bootstrap Apr 07, 2025 pm 11:33 PM

    在 Vue.js 中使用 Bootstrap 分為五個(gè)步驟:安裝 Bootstrap。在 main.js 中導(dǎo)入 Bootstrap。直接在模板中使用 Bootstrap 組件??蛇x:自定義樣式??蛇x:使用插件。

    bootstrap怎麼寫分割線 bootstrap怎麼寫分割線 Apr 07, 2025 pm 03:12 PM

    創(chuàng)建 Bootstrap 分割線有兩種方法:使用 標(biāo)籤,可創(chuàng)建水平分割線。使用 CSS border 屬性,可創(chuàng)建自定義樣式的分割線。

    bootstrap怎麼看日期 bootstrap怎麼看日期 Apr 07, 2025 pm 03:03 PM

    答案:可以使用 Bootstrap 的日期選擇器組件在頁面中查看日期。步驟:引入 Bootstrap 框架。在 HTML 中創(chuàng)建日期選擇器輸入框。 Bootstrap 將自動(dòng)為選擇器添加樣式。使用 JavaScript 獲取選定的日期。

    bootstrap搜索欄怎麼獲取 bootstrap搜索欄怎麼獲取 Apr 07, 2025 pm 03:33 PM

    如何使用 Bootstrap 獲取搜索欄的值:確定搜索欄的 ID 或名稱。使用 JavaScript 獲取 DOM 元素。獲取元素的值。執(zhí)行所需的操作。

    bootstrap日期怎麼驗(yàn)證 bootstrap日期怎麼驗(yàn)證 Apr 07, 2025 pm 03:06 PM

    在 Bootstrap 中驗(yàn)證日期,需遵循以下步驟:引入必需的腳本和樣式;初始化日期選擇器組件;設(shè)置 data-bv-date 屬性以啟用驗(yàn)證;配置驗(yàn)證規(guī)則(如日期格式、錯(cuò)誤消息等);集成 Bootstrap 驗(yàn)證框架,並在表單提交時(shí)自動(dòng)驗(yàn)證日期輸入。

    bootstrap按鈕怎麼用 bootstrap按鈕怎麼用 Apr 07, 2025 pm 03:09 PM

    如何使用 Bootstrap 按鈕?引入 Bootstrap CSS創(chuàng)建按鈕元素並添加 Bootstrap 按鈕類添加按鈕文本

    bootstrap怎麼設(shè)置框架 bootstrap怎麼設(shè)置框架 Apr 07, 2025 pm 03:27 PM

    要設(shè)置 Bootstrap 框架,需要按照以下步驟:1. 通過 CDN 引用 Bootstrap 文件;2. 下載文件並將其託管在自己的服務(wù)器上;3. 在 HTML 中包含 Bootstrap 文件;4. 根據(jù)需要編譯 Sass/Less;5. 導(dǎo)入定製文件(可選)。設(shè)置完成後,即可使用 Bootstrap 的網(wǎng)格系統(tǒng)、組件和樣式創(chuàng)建響應(yīng)式網(wǎng)站和應(yīng)用程序。

    為Web開發(fā)者準(zhǔn)備的10個(gè)最新工具 為Web開發(fā)者準(zhǔn)備的10個(gè)最新工具 May 07, 2025 pm 04:48 PM

    Web開發(fā)設(shè)計(jì)是一個(gè)充滿潛力的職業(yè)領(lǐng)域。然而,這個(gè)行業(yè)也面臨著諸多挑戰(zhàn)。隨著越來越多的企業(yè)和品牌轉(zhuǎn)向網(wǎng)絡(luò)市場,Web開發(fā)者有機(jī)會(huì)展示他們的技能並在職業(yè)生涯中取得成功。然而,隨著對(duì)Web開發(fā)需求的持續(xù)增長,開發(fā)人員的數(shù)量也在增加,導(dǎo)致競爭日益激烈。但令人振奮的是,如果你具備天賦和意願(yuàn),你總能找到新方法來創(chuàng)造獨(dú)特的設(shè)計(jì)和創(chuàng)意。作為一名Web開發(fā)人員,你可能需要不斷尋找新的工具和資源。這些新工具和資源不僅能讓你的工作更加便捷,還能提升工作質(zhì)量,從而幫助你贏得更多的業(yè)務(wù)和客戶。 Web開發(fā)的趨勢不斷變化,

    See all articles