2014-01-29 260 views
0

我正在使用bootstrap 3框架。我创建了一个模式窗口,它打开正常,我点击关闭按钮,没有任何反应。我在模态窗口外单击,并关闭将我返回到我的网页。我无法使关闭按钮正常工作。我试过'隐藏''切换'...什么都没有。任何洞察力非常感谢!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'); }); }); 

回答

1

你需要密切动作添加到该按钮,像这样: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> 
+0

帕斯卡,即措辞!现在我明白了......需要第二套眼睛。谢谢! –

+0

不要忘记投票并接受答案!谢谢! – pascalvgemert