BootStrap 彈出層代碼
廢話不多說了,直接給大家貼代碼了,具體代碼如下所示:
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Bootstrap</title>
<link rel="stylesheet" href="css/bootstrap.css" rel="external nofollow" />
</head>
<body>
<!--注意:1.彈出層必須放在body里
2.彈出層里面不能再嵌套別的層
3.彈出層彈出來以后,頁面的滾動條會被覆蓋-->
<div class="container">
<div class="row">
<button class="btn btn-primary" data-toggle="modal" data-target=".myModal1">彈出一個(gè)小層</button><!--data-toggle="modal"給button一個(gè)點(diǎn)擊事件,彈出一個(gè)模態(tài)窗口-->
<button class="btn btn-primary" data-toggle="modal" data-target=".myModal2">彈出一個(gè)大層</button>
</div>
</div>
<div class="modal fade myModal1"><!--modal,彈出層父級,fade使彈出層有一個(gè)運(yùn)動過程-->
<div class="modal-dialog"><!--modal-dialog,彈出層-->
<div class="modal-content"><!--modal-content,彈出層內(nèi)容區(qū)域-->
<div class="modal-header">
<button class="close" data-dismiss="modal">×</button><!--將關(guān)閉按鈕放在標(biāo)題前面可以使按鈕位于右上角-->
<h4>水果攤</h4>
</div><!--modal-header,彈出層頭部區(qū)域-->
<div class="modal-body">
<p>蘋果葡萄香蕉柿子火龍果便宜賣了,多買優(yōu)惠更多,還在等什么呢?</p>
<p>蘋果葡萄香蕉柿子火龍果便宜賣了,多買優(yōu)惠更多,還在等什么呢?</p>
<p>蘋果葡萄香蕉柿子火龍果便宜賣了,多買優(yōu)惠更多,還在等什么呢?</p>
</div><!--modal-body,彈出層主體區(qū)域-->
<div class="modal-footer">
<button class="btn btn-primary" data-dismiss="modal">確定</button><!--data-dismiss="modal"點(diǎn)擊按鈕之后可以關(guān)閉窗口-->
</div><!--modal-footer,彈出層底部區(qū)域-->
</div>
</div>
</div>
<div class="modal myModal2"><!---->
<div class="modal-dialog modal-lg"><!--還有modal-sm,modal-md-->
<div class="modal-content">
<div class="modal-header">
<button class="close" data-dismiss="modal">×</button>
<h4>水果攤</h4>
</div>
<div class="modal-body">
<p>蘋果葡萄香蕉柿子火龍果便宜賣了,多買優(yōu)惠更多,還在等什么呢?</p>
<p>蘋果葡萄香蕉柿子火龍果便宜賣了,多買優(yōu)惠更多,還在等什么呢?</p>
<p>蘋果葡萄香蕉柿子火龍果便宜賣了,多買優(yōu)惠更多,還在等什么呢?</p>
</div>
<div class="modal-footer">
<button class="btn btn-primary" data-dismiss="modal">確定</button>
</div>
</div>
</div>
</div>
<script src="js/jquery-2.1.0.js"></script>
<script src="js/bootstrap.js"></script>
</body>
</html>

以上所述是小編給大家介紹的BootStrap 彈出層代碼,希望對大家有所幫助,如果大家有任何疑問請給我留言,小編會及時(shí)回復(fù)大家的。在此也非常感謝大家對腳本之家網(wǎng)站的支持!
相關(guān)文章
各瀏覽器對document.getElementById等方法的實(shí)現(xiàn)差異解析
這篇文章主要是對各瀏覽器對document.getElementById等方法的實(shí)現(xiàn)差異進(jìn)行了詳細(xì)的分析介紹,需要的朋友可以過來參考下,希望對大家有所幫助2013-12-12
JavaScript中Hoisting詳解 (變量提升與函數(shù)聲明提升)
函數(shù)聲明和變量聲明總是被JavaScript解釋器隱式地提升(hoist)到包含他們的作用域的最頂端。下面這篇文章主要給大家介紹了關(guān)于JavaScript中Hoisting(變量提升與函數(shù)聲明提升)的相關(guān)資料,需要的朋友可以參考借鑒,下面來一起看看吧。2017-08-08
JS 中實(shí)現(xiàn)一個(gè)串型異步函數(shù)隊(duì)列
這篇文章主要介紹了JS 中實(shí)現(xiàn)一個(gè)串型異步函數(shù)隊(duì)列,文章通過async/await 串型請求展開詳情,具有一定的參考價(jià)值,需要的朋友可以參考一下2022-07-07
ES6基礎(chǔ)之 Promise 對象用法實(shí)例詳解
這篇文章主要介紹了ES6基礎(chǔ)之 Promise 對象用法,結(jié)合實(shí)例形式詳細(xì)分析了ES6中 Promise 對象功能、用法及相關(guān)操作注意事項(xiàng),需要的朋友可以參考下2019-08-08
layui動態(tài)表頭的實(shí)現(xiàn)代碼
這篇文章主要介紹了layui動態(tài)表頭的實(shí)現(xiàn)代碼,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧2019-08-08
JS+DIV+CSS排版布局實(shí)現(xiàn)美觀的選項(xiàng)卡效果
這篇文章主要介紹了JS+DIV+CSS排版布局實(shí)現(xiàn)美觀的選項(xiàng)卡效果,通過簡單的div+css布局結(jié)合JavaScript切換頁面樣式實(shí)現(xiàn)美觀的選項(xiàng)卡效果,具有一定參考借鑒價(jià)值,需要的朋友可以參考下2015-10-10
javascript中閉包c(diǎn)losure的深入講解
這篇文章主要給大家介紹了關(guān)于javascript中閉包c(diǎn)losure的相關(guān)資料,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧2021-03-03

