我创建了一个模态对话
<a href="#myModal" role="button" class="btn" data-toggle="modal" id="LaunchDemo">Launch demo modal</a>
<!-- Modal -->
<div id="myModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3 id="myModalLabel">Modal header</h3>
</div>
<div class="modal-body">
<p>One fine body…</p>
</div>
</div>
我刚刚从..中调用了模态
$("a#LaunchDemo").click();
但是模态只是在屏幕上闪烁
,我还通过单击按钮调用了模态。我遇到了同样的问题,我哪里出错了?请帮忙..
最佳答案
当 DOM 完全加载时,您需要执行 JavaScript 代码。并使用modal
而不是click
$(document).ready(function() {
$('#LaunchDemo').modal(options)
});
关于javascript - Twitter-Bootstrap Modal 无法正常工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14916390/