課程
/前端開發
/Bootstrap
/玩轉Bootstrap(基礎)
用alert測試shown.bs.modal和hidden.bs.modal兩個事件發現并沒有在事件發生后彈出alert啊,都是alert出現后彈出框的顯示和隱藏才完成。
2015-12-11
源自:玩轉Bootstrap(基礎) 8-12
正在回答
在使用下拉菜單的時候也出現這個問題了
給你的modal后面加一個fade過渡效果,保存測試就沒問題了
請問樓主的問題找到原因了嗎?因為我也出現了相同的問題
<!DOCTYPE?html> <html> <head> <meta?charset="utf-8"> <title>JavaScript觸發時的參數設置(二)</title> <link?rel="stylesheet"?> </head> <body> <button?class="btn?btn-primary"?type="button">點擊我</button> <div?class="modal"?id="mymodal"> ????<div?class="modal-dialog"> ????????<div?class="modal-content"> <div?class="modal-header"> <button?type="button"?class="close"?data-dismiss="modal"><span?aria-hidden="true">×</span><span?class="sr-only">Close</span></button> <h4?class="modal-title">模態彈出窗標題</h4> </div> <div?class="modal-body"> <p>模態彈出窗主體內容</p> </div> <div?class="modal-footer"> <button?type="button"?class="btn?btn-default"?data-dismiss="modal">關閉</button> <button?type="button"?class="btn?btn-primary">保存</button> </div> </div><!--?/.modal-content?--> </div><!--?/.modal-dialog?--> </div><!--?/.modal?--> <script?src="http://libs.baidu.com/jquery/1.9.0/jquery.js"></script> <script?src="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>? <script> ??$(function(){ ????$(".btn").click(function(){ ??????$("#mymodal").modal("toggle"); ????}); ????$('#mymodal').on('show.bs.modal',?function?(e)?{ ????????alert('show.bs.modal') ????}); ????$('#mymodal').on('shown.bs.modal',?function?(e)?{ ????????alert('shown.bs.modal') ????}) ??}); </script> </body> </html>
不一樣的,你可以再試一下,一個先彈,一個是在彈框出來后彈的。
SASE 提問者
李曉健 回復 SASE 提問者
舉報
告訴你使用Bootstrap,并且能夠獨立定制出適合自己的Bootstrap
1 回答列與列之間的間隔
2 回答bootstrap樣式與原樣式的區別
2 回答alert事件似乎點擊次數遞加才起作用
1 回答不同頁面用的樣式與全局樣式沖突以那個為主
2 回答為什么少了<button>里的id與<ul>里的aria-labelledby還跟上一節的顯示效果一樣??
Copyright ? 2025 imooc.com All Rights Reserved | 京ICP備12003892號-11 京公網安備11010802030151號
購課補貼聯系客服咨詢優惠詳情
慕課網APP您的移動學習伙伴
掃描二維碼關注慕課網微信公眾號
2018-11-20
在使用下拉菜單的時候也出現這個問題了
2018-10-30
給你的modal后面加一個fade過渡效果,保存測試就沒問題了
2017-10-10
請問樓主的問題找到原因了嗎?因為我也出現了相同的問題
2015-12-11
<!DOCTYPE?html> <html> <head> <meta?charset="utf-8"> <title>JavaScript觸發時的參數設置(二)</title> <link?rel="stylesheet"?> </head> <body> <button?class="btn?btn-primary"?type="button">點擊我</button> <div?class="modal"?id="mymodal"> ????<div?class="modal-dialog"> ????????<div?class="modal-content"> <div?class="modal-header"> <button?type="button"?class="close"?data-dismiss="modal"><span?aria-hidden="true">×</span><span?class="sr-only">Close</span></button> <h4?class="modal-title">模態彈出窗標題</h4> </div> <div?class="modal-body"> <p>模態彈出窗主體內容</p> </div> <div?class="modal-footer"> <button?type="button"?class="btn?btn-default"?data-dismiss="modal">關閉</button> <button?type="button"?class="btn?btn-primary">保存</button> </div> </div><!--?/.modal-content?--> </div><!--?/.modal-dialog?--> </div><!--?/.modal?--> <script?src="http://libs.baidu.com/jquery/1.9.0/jquery.js"></script> <script?src="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>? <script> ??$(function(){ ????$(".btn").click(function(){ ??????$("#mymodal").modal("toggle"); ????}); ????$('#mymodal').on('show.bs.modal',?function?(e)?{ ????????alert('show.bs.modal') ????}); ????$('#mymodal').on('shown.bs.modal',?function?(e)?{ ????????alert('shown.bs.modal') ????}) ??}); </script> </body> </html>不一樣的,你可以再試一下,一個先彈,一個是在彈框出來后彈的。