本文實(shí)例講述了Bootstrap模態(tài)對(duì)話框用法。分享給大家供大家參考,具體如下:
環(huán)境:bootstrap-3.3.5,jquery-3.0.0
代碼:
<!DOCTYPE html> <html> <head> <title>www.gxlcms.com bootstrap模態(tài)對(duì)話框</title> <meta http-equiv="Content-type" content="text/html; charset=utf-8"> <link rel="stylesheet" rel="external nofollow" /> <link rel="stylesheet" rel="external nofollow" /> <script src="https://cdn.bootcss.com/jquery/3.0.0/jquery.min.js" ></script> <script src="https://cdn.bootcss.com/bootstrap/3.3.5/js/bootstrap.min.js" ></script> </head> <body> <h2>創(chuàng)建模態(tài)框(Modal)</h2> <!-- 按鈕觸發(fā)模態(tài)框 --> <button class="btn btn-primary btn-lg" data-toggle="modal" data-target="#myModal"> 開始演示模態(tài)框 </button> <!-- 模態(tài)框(Modal) --> <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"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true"> × </button> <h4 class="modal-title" id="myModalLabel"> 模態(tài)框(Modal)標(biāo)題 </h4> </div> <div class="modal-body"> 在這里添加一些文本 </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>
小編已經(jīng)將代碼中所引用的bootstrap相關(guān)css、js文件全部換成了cdn形式,方便測(cè)試。
這里使用在線HTML/CSS/JavaScript代碼運(yùn)行工具:http://tools.jb51.net/code/HtmlJsRun測(cè)試,可得到如下顯示效果:
PS:關(guān)于bootstrap布局,這里再為大家推薦一款本站的在線可視化布局工具供大家參考使用:
在線bootstrap可視化布局編輯工具:
http://tools.jb51.net/aideddesign/layoutit
希望本文所述對(duì)大家基于bootstrap的程序設(shè)計(jì)有所幫助。
聲明:本網(wǎng)頁內(nèi)容旨在傳播知識(shí),若有侵權(quán)等問題請(qǐng)及時(shí)與本網(wǎng)聯(lián)系,我們將在第一時(shí)間刪除處理。TEL:177 7030 7066 E-MAIL:11247931@qq.com