亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

annuaire recherche
Getting started Accessibility(無障礙) Browsers and devices(瀏覽器和設(shè)備) Build tools(構(gòu)建工具) Contents(內(nèi)容) Download(下載) JavaScript Theming Bootstrap(主題Bootstrap) Webpack Components: Alerts Alerts(警報) Components: Badges Badges(徽章) Components: Breadcrumb Breadcrumb Components: Button group Button group(按鈕組) Components: Buttons Buttons(按鈕) Components: Cards Components: Carousel Cards(卡) Carousel(圓盤傳送帶) Components: Collapse Collapse(折疊) Components: Dropdowns Dropdowns(下拉菜單) Components: Forms Forms(表單) Components: Input group Input group(輸入群組) Components: Input group Jumbotron(廣告大屏幕) Components: List group List group(列表組) Components: Modal Modal(互動視窗) Components: Navbar Navbar(導(dǎo)航欄) Components: Navs Navs(導(dǎo)航欄) Components: Pagination Pagination(分頁) Components: Popovers Popovers(彈出框) Components: Progress Progress(進(jìn)度條) Components: Scrollspy Scrollspy(滾動監(jiān)聽) Components: Tooltips Tooltips(提示工具) Content Code(代碼) Figures(圖片區(qū)) Images(圖片) Reboot(重置) Tables(表格) Typography(排版) Layout Grid(網(wǎng)格) Layout(布局) Media object(多媒體對象) Utilities for layout(排版通用類別) Migration Migrating to v4(遷移到v4) Utilities Borders(邊框) Clearfix(清除浮動) Close icon(關(guān)閉圖標(biāo)) Colors(顏色) Display property(顯示屬性) Embeds(內(nèi)嵌) Flex(彈性) Float(浮動) Image replacement(圖像替換) Position(位置) Screenreaders(熒幕閱讀器) Sizing(尺寸) Spacing(間隔) Text(文本) Vertical alignment(垂直對齊) Visibility(能見度)
personnages

使用 Bootstrap 的 JavaScript 模式插件為您的網(wǎng)站添加對話框,了解 Lightbox,用戶通知或完全自定義內(nèi)容。

怎么運(yùn)行的

在開始使用 Bootstrap 的模塊組件之前,請務(wù)必閱讀以下內(nèi)容,因?yàn)槲覀兊牟藛芜x項(xiàng)最近已更改。

  • Modals 是用 HTML,CSS 和 JavaScript 構(gòu)建的。它們位于文檔中的所有其他位置,并從滾動中移除,<body>以便模式內(nèi)容可以滾動。

  • 點(diǎn)擊模式“背景”會自動關(guān)閉模式。

  • Bootstrap 一次只支持一個模式窗口。不支持嵌套模式,因?yàn)槲覀冋J(rèn)為它們是糟糕的用戶體驗(yàn)。

  • 模態(tài)的使用position: fixed,有時候?qū)λ匿秩居悬c(diǎn)特別。盡可能將模態(tài) HTML 置于頂層位置,以避免其他元素的潛在干擾。嵌套.modal在另一個固定元素中時,您可能會遇到問題。

  • 由于position: fixed這一點(diǎn),在移動設(shè)備上使用模塊還有一些注意事項(xiàng)。有關(guān)詳情,請參閱我們的瀏覽器支持文檔

  • 由于 HTML5 定義了其語義,因此autofocusHTML 屬性在 Bootstrap 模式中不起作用。要達(dá)到相同的效果,請使用一些自定義 JavaScript:

$('#myModal').on('shown.bs.modal', function () {  $('#myInput').trigger('focus')})

請繼續(xù)閱讀演示和使用指南。

示例

模態(tài)組件

下面是一個靜態(tài)模式的例子(指其positiondisplay被覆蓋)。包括模態(tài)標(biāo)題,模態(tài)主體(必需padding)和模態(tài)頁腳(可選)。我們要求您在可能的情況下包含解除操作的模態(tài)標(biāo)頭,或者提供另一個明確的解雇操作。

<div class="modal" tabindex="-1" role="dialog">  <div class="modal-dialog" role="document">    <div class="modal-content">      <div class="modal-header">        <h5 class="modal-title">Modal title</h5>        <button type="button" class="close" data-dismiss="modal" aria-label="Close">          <span aria-hidden="true">&times;</span>        </button>      </div>      <div class="modal-body">        <p>Modal body text goes here.</p>      </div>      <div class="modal-footer">        <button type="button" class="btn btn-primary">Save changes</button>        <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>      </div>    </div>  </div></div>

現(xiàn)場演示

點(diǎn)擊下面的按鈕來切換工作模式演示。它會滑下并從頁面頂部淡入。

<!-- Button trigger modal --><button type="button" class="btn btn-primary" data-toggle="modal" data-target="#exampleModal">
  Launch demo modal</button><!-- Modal --><div class="modal fade" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">  <div class="modal-dialog" role="document">    <div class="modal-content">      <div class="modal-header">        <h5 class="modal-title" id="exampleModalLabel">Modal title</h5>        <button type="button" class="close" data-dismiss="modal" aria-label="Close">          <span aria-hidden="true">&times;</span>        </button>      </div>      <div class="modal-body">        ...      </div>      <div class="modal-footer">        <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>        <button type="button" class="btn btn-primary">Save changes</button>      </div>    </div>  </div></div>

滾動長內(nèi)容

當(dāng)模式對用戶的視口或設(shè)備變得太長時,它們將獨(dú)立于頁面自身進(jìn)行滾動。試試下面的演示,看看我們的意思。

<!-- Button trigger modal --><button type="button" class="btn btn-primary" data-toggle="modal" data-target="#exampleModalLong">
  Launch demo modal</button><!-- Modal --><div class="modal fade" id="exampleModalLong" tabindex="-1" role="dialog" aria-labelledby="exampleModalLongTitle" aria-hidden="true">  <div class="modal-dialog" role="document">    <div class="modal-content">      <div class="modal-header">        <h5 class="modal-title" id="exampleModalLongTitle">Modal title</h5>        <button type="button" class="close" data-dismiss="modal" aria-label="Close">          <span aria-hidden="true">&times;</span>        </button>      </div>      <div class="modal-body">        ...      </div>      <div class="modal-footer">        <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>        <button type="button" class="btn btn-primary">Save changes</button>      </div>    </div>  </div></div>

工具提示和彈出

工具提示和彈出可以根據(jù)需要放置在模塊中。當(dāng)模式關(guān)閉時,其中的任何工具提示和彈出窗口也會自動解除。

<div class="modal-body">  <h5>Popover in a modal</h5>  <p>This <a href="#" role="button" class="btn btn-secondary popover-test" title="Popover title" data-content="Popover body content is set in this attribute.">button</a> triggers a popover on click.</p>  <hr>  <h5>Tooltips in a modal</h5>  <p><a href="#" class="tooltip-test" title="Tooltip">This link</a> and <a href="#" class="tooltip-test" title="Tooltip">that link</a> have tooltips on hover.</p></div>

使用網(wǎng)格

通過.modal-body嵌套.container-fluid利用模式中的引導(dǎo)網(wǎng)格系統(tǒng)內(nèi)。然后,像任何其他地方一樣使用正常的網(wǎng)格系統(tǒng)類。

<div class="modal-body">  <div class="container-fluid">    <div class="row">      <div class="col-md-4">.col-md-4</div>      <div class="col-md-4 ml-auto">.col-md-4 .ml-auto</div>    </div>    <div class="row">      <div class="col-md-3 ml-auto">.col-md-3 .ml-auto</div>      <div class="col-md-2 ml-auto">.col-md-2 .ml-auto</div>    </div>    <div class="row">      <div class="col-md-6 ml-auto">.col-md-6 .ml-auto</div>    </div>    <div class="row">      <div class="col-sm-9">
        Level 1: .col-sm-9        <div class="row">          <div class="col-8 col-sm-6">
            Level 2: .col-8 .col-sm-6          </div>          <div class="col-4 col-sm-6">
            Level 2: .col-4 .col-sm-6          </div>        </div>      </div>    </div>  </div></div>

改變模態(tài)內(nèi)容

有一堆按鈕都會觸發(fā)相同的模式,但內(nèi)容稍有不同?使用event.relatedTarget和 HTML data-*屬性(可能通過 jQuery)根據(jù)點(diǎn)擊哪個按鈕來改變模式的內(nèi)容。

下面是一個現(xiàn)場演示,后面是示例 HTML 和 JavaScript。有關(guān)更多信息,請閱讀模式事件文檔以獲取詳細(xì)信息在relatedTarget上。

<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#exampleModal" data-whatever="@mdo">Open modal for @mdo</button><button type="button" class="btn btn-primary" data-toggle="modal" data-target="#exampleModal" data-whatever="@fat">Open modal for @fat</button><button type="button" class="btn btn-primary" data-toggle="modal" data-target="#exampleModal" data-whatever="@getbootstrap">Open modal for @getbootstrap</button><div class="modal fade" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">  <div class="modal-dialog" role="document">    <div class="modal-content">      <div class="modal-header">        <h5 class="modal-title" id="exampleModalLabel">New message</h5>        <button type="button" class="close" data-dismiss="modal" aria-label="Close">          <span aria-hidden="true">&times;</span>        </button>      </div>      <div class="modal-body">        <form>          <div class="form-group">            <label for="recipient-name" class="col-form-label">Recipient:</label>            <input type="text" class="form-control" id="recipient-name">          </div>          <div class="form-group">            <label for="message-text" class="col-form-label">Message:</label>            <textarea class="form-control" id="message-text"></textarea>          </div>        </form>      </div>      <div class="modal-footer">        <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>        <button type="button" class="btn btn-primary">Send message</button>      </div>    </div>  </div></div>
$('#exampleModal').on('show.bs.modal', function (event) {  var button = $(event.relatedTarget) // Button that triggered the modal  var recipient = button.data('whatever') // Extract info from data-* attributes  // If necessary, you could initiate an AJAX request here (and then do the updating in a callback).  // Update the modal's content. We'll use jQuery here, but you could use a data binding library or other methods instead.  var modal = $(this)
  modal.find('.modal-title').text('New message to ' + recipient)
  modal.find('.modal-body input').val(recipient)})

刪除動畫

對于簡單出現(xiàn)而不是淡入查看的模態(tài),從模態(tài)標(biāo)記中刪除.fade類。

<div class="modal" tabindex="-1" role="dialog" aria-labelledby="..." aria-hidden="true">  ...</div>

動態(tài)高度

如果模態(tài)的高度在打開時發(fā)生變化,您應(yīng)該調(diào)用$('#myModal').data('bs.modal').handleUpdate()$('#myModal').modal('handleUpdate')重新調(diào)整模態(tài)的位置以防出現(xiàn)滾動條。

無障礙

一定要加role="dialog"aria-labelledby="...",引用模式稱號,.modal以及role="document".modal-dialog本身。另外,你可以在上.modalaria-describedby來描述你的模態(tài)對話框。

嵌入 YouTube 視頻

以模式嵌入 YouTube 視頻需要不在 Bootstrap 中的其他 JavaScript 才能自動停止播放等等。看到這個有用的堆棧溢出帖子了解更多信息。

可選尺寸

Modals 有兩個可選的尺寸,可通過修飾符類放置在一個.modal-dialog上。這些尺寸在某些斷點(diǎn)處啟動以避免較窄視口上的水平滾動條。

<!-- Large modal --><button type="button" class="btn btn-primary" data-toggle="modal" data-target=".bd-example-modal-lg">Large modal</button><div class="modal fade bd-example-modal-lg" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true">  <div class="modal-dialog modal-lg">    <div class="modal-content">      ...    </div>  </div></div><!-- Small modal --><button type="button" class="btn btn-primary" data-toggle="modal" data-target=".bd-example-modal-sm">Small modal</button><div class="modal fade bd-example-modal-sm" tabindex="-1" role="dialog" aria-labelledby="mySmallModalLabel" aria-hidden="true">  <div class="modal-dialog modal-sm">    <div class="modal-content">      ...    </div>  </div></div>

用法

模式插件通過數(shù)據(jù)屬性或JavaScript來按需切換隱藏內(nèi)容。它還增加.modal-open<body>覆蓋默認(rèn)的滾動行為,并生成一個.modal-backdrop提供點(diǎn)擊區(qū)域來解除在模態(tài)外單擊時顯示的模態(tài)。

通過數(shù)據(jù)屬性

無需編寫 JavaScript 即可激活模式。在一個控制器元素上設(shè)置data-toggle="modal",就像一個按鈕一起,data-target="#foo"或者href="#foo"將一個特定的模式作為切換目標(biāo)。

<button type="button" data-toggle="modal" data-target="#myModal">Launch modal</button>

通過 JavaScript

用一行 JavaScript 調(diào)用帶 idmyModal的模式:

$('#myModal').modal(options)

選項(xiàng)

選項(xiàng)可以通過數(shù)據(jù)屬性或 JavaScript 傳遞。對于數(shù)據(jù)屬性,請將選項(xiàng)名稱附加到data-中,如data-backdrop=""。

名稱

類型

默認(rèn)

描述

backdrop

布爾值或字符串'static'

包含模態(tài)背景元素。或者,為點(diǎn)擊時不關(guān)閉模式的背景指定靜態(tài)。

keyboard

布爾

按下退出鍵時關(guān)閉模式

focus

布爾

初始化時將重點(diǎn)放在模態(tài)上。

show

布爾

初始化時顯示模式。

方法

異步方法和轉(zhuǎn)換

所有 API 方法都是異步的并開始轉(zhuǎn)換。一旦轉(zhuǎn)換開始但在結(jié)束之前,它們就立即返回給調(diào)用者。另外,對轉(zhuǎn)換組件的方法調(diào)用將被忽略。

查看我們的 JavaScript 文檔以獲取更多信息。

.modal(options)

激活您的內(nèi)容作為模式。接受可選的選項(xiàng)object。

$('#myModal').modal({
  keyboard: false})

.modal('toggle')

手動切換模式。返回到之前的模態(tài)主叫方實(shí)際上已顯示或隱藏(IE 瀏覽器之前shown.bs.modalhidden.bs.modal事件發(fā)生時)。

$('#myModal').modal('toggle')

.modal('show')

手動打開模式。在實(shí)際顯示模態(tài)之前(即shown.bs.modal事件發(fā)生之前)返回給調(diào)用者。

$('#myModal').modal('show')

.modal('hide')

手動隱藏模式。在模態(tài)被隱藏之前(即hidden.bs.modal事件發(fā)生之前)返回給調(diào)用者。

$('#myModal').modal('hide')

.modal('handleUpdate')

如果模態(tài)的高度在打開時發(fā)生變化(例如出現(xiàn)滾動條),則手動重新調(diào)整模態(tài)的位置。

$('#myModal').modal('handleUpdate')

.modal('dispose')

銷毀一個元素的模態(tài)。

活動

Bootstrap 的模態(tài)類公開了一些鉤住模態(tài)功能的事件。所有的模態(tài)事件都是在模態(tài)本身(即在<div class="modal">)處被觸發(fā)的。

事件類型

描述

show.bs.modal

當(dāng) show instance 方法被調(diào)用時,此事件立即觸發(fā)。如果由于點(diǎn)擊而導(dǎo)致點(diǎn)擊的元素可用作事件的 relatedTarget 屬性。

shown.bs.modal

當(dāng)模式對用戶可見時會觸發(fā)此事件(將等待 CSS 轉(zhuǎn)換完成)。如果由于點(diǎn)擊而導(dǎo)致點(diǎn)擊的元素可用作事件的 relatedTarget 屬性。

hide.bs.modal

當(dāng)調(diào)用隱藏實(shí)例方法時立即觸發(fā)此事件。

hidden.bs.modal

當(dāng)模式完成對用戶的隱藏時,會觸發(fā)此事件(等待 CSS 轉(zhuǎn)換完成)。

$('#myModal').on('hidden.bs.modal', function (e) {  // do something...})
Article précédent: Article suivant: