我正在使用Bootstrap 3框架。我创建了一个模态窗口,打开了正常,我单击"关闭"按钮,什么也不会发生。我单击模式窗口外,它关闭了将我返回到我的网页。我无法获得关闭按钮上班。我尝试过"隐藏"切换" ...什么都没有。任何洞察力都非常感谢!
> <div class="person"> <h2>Person name</h2> <p><a href="#"
> id="John-bio" class="position"> John Smiths Bio</a></p>
> <div class="modal hide" id="John">
> <div class="modal-header"> <h1> John Smith Bio</h1> </div>
> <div class="modal-body"> <p>With more than...</div>
> <div class="modal-footer"> <a href="#" class="btn">Close</a> </div>
> $(function() {
> $("#John-bio").click(function(e) { e.preventDefault();
> $("#John").modal('show'); }); });
您需要在这样的按钮上添加一个密切操作: data-dismiss="modal"
<div class="modal hide" id="John">
> <div class="modal-header"> <h1> John Smith Bio</h1> </div>
> <div class="modal-body"> <p>With more than...</div>
> <div class="modal-footer"> <a href="#" class="btn" data-dismiss="modal">Close</a>
</div>