亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

Bootstrap實現(xiàn)模態(tài)框效果

 更新時間:2019年09月30日 07:42:42   作者:瘦十斤改昵稱  
這篇文章主要為大家詳細介紹了Bootstrap實現(xiàn)模態(tài)框效果,文中示例代碼介紹的非常詳細,具有一定的參考價值,感興趣的小伙伴們可以參考一下

一、模態(tài)框(Modal)是覆蓋在父窗體上的子窗體。通常,目的是顯示來自一個單獨的源的內(nèi)容,可以在不離開父窗體的情況下有一些互動。子窗體可提供信息、交互等。

二、如果想要單獨引用該插件的功能,那么您需要引用 modal.js。或者可以引用 bootstrap.js 或壓縮版的 bootstrap.min.js

引入之后直接上代碼示例:

<!DOCTYPE html>
<html>
 <head>
 <meta charset="utf-8"> 
 <title>Bootstrap 實例 - 模態(tài)框(Modal)插件</title>
 <link rel="stylesheet"  rel="external nofollow" >
 <script src="https://cdn.staticfile.org/jquery/2.1.1/jquery.min.js"></script>
 <script src="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script>
 </head>
 <body>
 
 <h2>創(chuàng)建模態(tài)框(Modal)</h2>
 <!-- 
 按鈕觸發(fā)模態(tài)框:
 class="btn btn-primary btn-lg":是指定class為"按鈕的加大primary"樣式
 data-toggle="modal":應(yīng)該是模態(tài)框的固定寫法,只能為modal,至少自己試驗發(fā)現(xiàn)是這樣的
 data-target="#myModal":通過選擇器指向 id="myModal" 的元素,也就是要顯示和隱藏的模態(tài)框目標
 -->
 <button class="btn btn-primary btn-lg" data-toggle="modal" data-target="#myModal">
 開始演示模態(tài)框
 </button>
 <!-- 模態(tài)框(Modal) -->
 <!-- 
 class="modal fade": modal——用來把div識別成模態(tài)框 fade——當模態(tài)框被切換時,內(nèi)容會淡入淡出
 id="myModal":就是被指定為上面說的data-target屬性選擇的元素
 tabindex:屬性規(guī)定元素的 tab 鍵控制次序
 aria-labelledby="myModalLabel":引用模態(tài)框的標題(去掉影響不大)
 aria-hidden:="true":設(shè)置模態(tài)框不可見,等到點擊按鈕之后顯示
 -->
 <div class="modal fade" id="myModal" tabindex="1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
 <div class="modal-dialog">
 <div class="modal-content">
 <div class="modal-header">
 <!-- data-dismiss="modal":加上這個,使得點擊該button時會關(guān)閉模態(tài)框,下面的關(guān)閉按鈕也是一樣加了這個屬性 -->
 <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
 &times;
 </button>
 <h4 class="modal-title" id="myModalLabel">
 模態(tài)框(Modal)標題
 </h4>
 </div>
 <div class="modal-body">
 <input type="text" placeholder="輸入......">
 </div>
 <div class="modal-footer">
 <button type="button" class="btn btn-default" data-dismiss="modal">關(guān)閉</button>
 <button type="button" class="btn btn-primary">提交更改</button>
 </div>
 </div><!-- /.modal-content -->
 </div><!-- /.modal -->
 </div>
 </body>
</html>

運行效果圖如下:

如果大家還想深入學習,可以點擊這里進行學習,再為大家附3個精彩的專題:

Bootstrap學習教程

Bootstrap實戰(zhàn)教程

Bootstrap插件使用教程

以上就是關(guān)于本文的全部內(nèi)容,希望對大家的學習有所幫助。

相關(guān)文章

最新評論