Bootstrap Modal對(duì)話框如何在關(guān)閉時(shí)觸發(fā)事件
下表列出了模態(tài)框中要用到事件。這些事件可在函數(shù)中當(dāng)鉤子使用。
實(shí)例
下面的實(shí)例演示了事件的用法:
<!DOCTYPE html> <html> <head> <title>Bootstrap 實(shí)例 - 模態(tài)框(Modal)插件事件</title> <link href="/bootstrap/css/bootstrap.min.css" rel="stylesheet"> <script src="/scripts/jquery.min.js"></script> <script src="/bootstrap/js/bootstrap.min.js"></script> </head> <body> <h2>模態(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"> 點(diǎn)擊關(guān)閉按鈕檢查事件功能。 </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-dialog --> </div><!-- /.modal --> <script> $(function () { $('#myModal').modal('hide')})}); </script> <script> $(function () { $('#myModal').on('hide.bs.modal', function () { alert('嘿,我聽說(shuō)您喜歡模態(tài)框...');}) }); </script> </body> </html>
更多內(nèi)容請(qǐng)點(diǎn)擊專題《Bootstrap Modal使用教程》進(jìn)行學(xué)習(xí),希望大家喜歡。
如果大家還想深入學(xué)習(xí),可以點(diǎn)擊這里進(jìn)行學(xué)習(xí),再為大家附3個(gè)精彩的專題:
以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。
相關(guān)文章
框架頁(yè)面高度自動(dòng)刷新的Javascript腳本
框架頁(yè)面高度自動(dòng)刷新,加載index.htm時(shí)候,每隔1秒鐘自動(dòng)調(diào)用腳本刷新框架頁(yè)面代碼,具體實(shí)現(xiàn)如下,感興趣的朋友可以了解下2013-11-11location.hash保存頁(yè)面狀態(tài)的技巧
hash 屬性是一個(gè)可讀可寫的字符串,該字符串是 URL 的錨部分(從 # 號(hào)開始的部分)。接下來(lái)通過(guò)本文給大家介紹location.hash保存頁(yè)面狀態(tài)的相關(guān)內(nèi)容,感興趣的朋友一起學(xué)習(xí)吧2016-04-04Python版實(shí)現(xiàn)微信公眾號(hào)掃碼登陸
這篇文章主要介紹了Python版實(shí)現(xiàn)微信公眾號(hào)掃碼登陸,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧2020-05-05BootStrap智能表單實(shí)戰(zhàn)系列(四)表單布局介紹
這篇文章主要介紹了BootStrap智能表單實(shí)戰(zhàn)系列(四)表單布局介紹,表單布局分為自動(dòng)布局和自定義布局兩種,本文通過(guò)代碼給大家介紹,介紹的非常詳細(xì),具有參考借鑒價(jià)值,感興趣的朋友一起學(xué)習(xí)吧2016-06-06JS+CSS實(shí)現(xiàn)滾動(dòng)數(shù)字時(shí)鐘效果
本篇文章教給大家用JS代碼配合CSS樣式來(lái)實(shí)現(xiàn)滾動(dòng)時(shí)鐘的動(dòng)畫效果,一起來(lái)學(xué)習(xí)下。2017-12-12用innerHTML?。Ψ?hào)副值給文本框后會(huì)變成&amp;的方法
用innerHTML?。Ψ?hào)副值給文本框后會(huì)變成&amp;的方法...2007-07-07