【问题标题】:bootstrap 3 modal window close button will not close modal windowbootstrap 3 模态窗口关闭按钮不会关闭模态窗口
【发布时间】:2014-01-29 15:15:51
【问题描述】:

我正在使用 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'); }); });

【问题讨论】:

    标签: javascript twitter-bootstrap


    【解决方案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> 
    

    【讨论】:

    • 帕斯卡,那个措辞!现在我当然看到了……需要第二双眼睛。谢谢!
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-06-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多