根据医生的说法:
http://getbootstrap.com/javascript/#modals
它应该触发"show.bs.dropdown“和"shown.bs.dropdown”方法。但事实并非如此:
http://jsfiddle.net/mQunq/3/
HTML:
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">Hello world</div>
</div>
</div>jQuery:
// show.bs.modal doesn't work either
$('#myModal')
.modal('show')
.on('show.bs.modal', function() {
alert('shown baby!');
});发布于 2013-10-29 15:54:25
您需要先注册事件然后触发它。
$('#myModal')
.on('show.bs.modal', function() {
alert('shown baby!');
}).modal('show');小提琴
发布于 2014-11-06 16:12:55
类似的事情发生在我身上,我用setTimeout解决了问题。
引导程序使用以下超时来完成显示:
c.TRANSITION_DURATION=300,c.BACKDROP_TRANSITION_DURATION=150,
因此,使用300多个必须工作,对我来说,200是有效的:
$('#myModal').on('show.bs.modal', function (e) {
setTimeout(function(){
//Do something if necessary
}, 300);
})发布于 2013-10-29 15:55:50
你忘了上面的"n“
$(document).ready(function(){
$('#myModal')
.modal('show')
.on('shown.bs.modal', function() {
alert('shown baby!');
});
});https://stackoverflow.com/questions/19662896
复制相似问题