關(guān)于Bootstrap彈出框無(wú)法調(diào)用問題的解決辦法
問題描述
寫項(xiàng)目中使用到了前端框架bootstrap,提供的功能很強(qiáng)大!
bootstrap學(xué)習(xí)
然而在用bootstrap提供的彈出框組件時(shí),彈出框怎么也彈不出!
按理說(shuō)應(yīng)該這樣:
官方給出的樣例是這樣寫的:
<!DOCTYPE html> <html> <head> <title>Bootstrap 實(shí)例 - 彈出框(Popover)插件</title> <link rel="stylesheet"> <script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script> <script src="http://libs.baidu.com/bootstrap/3.0.3/js/bootstrap.min.js"></script> </head> <body> <div class="container" style="padding: 100px 50px 10px;" > <button type="button" class="btn btn-default" title="Popover title" data-container="body" data-toggle="popover" data-placement="left" data-content="左側(cè)的 Popover 中的一些內(nèi)容"> 左側(cè)的 Popover </button> <button type="button" class="btn btn-primary" title="Popover title" data-container="body" data-toggle="popover" data-placement="top" data-content="頂部的 Popover 中的一些內(nèi)容"> 頂部的 Popover </button> <button type="button" class="btn btn-success" title="Popover title" data-container="body" data-toggle="popover" data-placement="bottom" data-content="底部的 Popover 中的一些內(nèi)容"> 底部的 Popover </button> <button type="button" class="btn btn-warning" title="Popover title" data-container="body" data-toggle="popover" data-placement="right" data-content="右側(cè)的 Popover 中的一些內(nèi)容"> 右側(cè)的 Popover </button> </div> <script>$(function () { $("[data-toggle='popover']").popover(); }); </script> </div> </body> </html>
代碼檢查了三遍,確定代碼無(wú)誤后,進(jìn)入火狐debug,
<script> $(function () { $("[data-toggle='popover']").popover(); }); </script>
這一段代碼是全局的,一進(jìn)入頁(yè)面就會(huì)激活,直接跳進(jìn)入了bootstrap的js框架:
居然說(shuō)我jquery沒有引入!但我明明引入了!
<link rel="stylesheet" href="css/bootstrap.min.css"/> <script type="text/javascript" src="js/bootstrap.min.js" ></script> <script type="text/javascript" src="js/jquery.min.js" ></script>
智障嗎?。。。。。。
后來(lái)一想,bootstrap依賴jquery,于是我抱著試一試的心態(tài)調(diào)整了引用順序:
<script type="text/javascript" src="js/jquery.min.js" ></script> <script type="text/javascript" src="js/bootstrap.min.js" ></script>
通過(guò)以上內(nèi)容介紹Bootstrap彈出框無(wú)法調(diào)用問題就順利解決了,遇到bootstrap彈出框問題的朋友可以參考下本教程。
- 在iframe中使bootstrap的模態(tài)框在父頁(yè)面彈出問題
- Bootstrap彈出框之自定義懸??驑?biāo)題、內(nèi)容和樣式示例代碼
- Bootstrap的popover(彈出框)2秒后定時(shí)消失的實(shí)現(xiàn)代碼
- 擴(kuò)展bootstrap的modal模態(tài)框-動(dòng)態(tài)添加modal框-彈出多個(gè)modal框
- Bootstrap實(shí)現(xiàn)提示框和彈出框效果
- Bootstrap實(shí)現(xiàn)帶動(dòng)畫過(guò)渡的彈出框
- Bootstrap編寫一個(gè)在當(dāng)前網(wǎng)頁(yè)彈出可關(guān)閉的對(duì)話框 非彈窗
- Bootstrap彈出框(modal)垂直居中的問題及解決方案詳解
- JS組件Bootstrap實(shí)現(xiàn)彈出框和提示框效果代碼
- bootstrap實(shí)現(xiàn)點(diǎn)擊刪除按鈕彈出確認(rèn)框的實(shí)例代碼
相關(guān)文章
細(xì)數(shù)promise與async/await的使用及區(qū)別說(shuō)明
這篇文章主要介紹了細(xì)數(shù)promise與async/await的使用及區(qū)別說(shuō)明,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教2022-07-07JavaScript 字符串常用操作小結(jié)(非常實(shí)用)
這篇文章主要介紹了JavaScript 字符串常用操作的知識(shí),包括字符串截取,查找類的方法,對(duì)js字符串操作相關(guān)知識(shí)感興趣的朋友一起學(xué)習(xí)吧2016-11-11使用webpack/gulp構(gòu)建TypeScript項(xiàng)目的方法示例
這篇文章主要介紹了使用webpack/gulp構(gòu)建TypeScript項(xiàng)目的方法示例,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧2019-12-12js結(jié)合正則實(shí)現(xiàn)國(guó)內(nèi)手機(jī)號(hào)段校驗(yàn)
這篇文章主要介紹了js結(jié)合正則實(shí)現(xiàn)國(guó)內(nèi)手機(jī)號(hào)段校驗(yàn)的方法以及使用js和jQuery實(shí)現(xiàn)的簡(jiǎn)單校驗(yàn)手機(jī)號(hào)的示例,非常簡(jiǎn)單實(shí)用,有需要的小伙伴可以參考下。2015-06-06