【问题标题】:Bootstrap: Twitter Bootstrap Modal not hidden when page loaded [closed]Bootstrap:加载页面时未隐藏 Twitter Bootstrap 模式 [关闭]
【发布时间】:2012-10-03 18:14:17
【问题描述】:

我复制了与给出的示例完全相同的代码:

<-- Button to trigger modal -->
<a href="#myModal" role="button" class="btn" data-toggle="modal">Launch demo modal</a>

<-- Modal -->
<div class="modal" id="myModal" 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 class="modal-footer">
<button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
<button class="btn btn-primary">Save changes</button>
</div>
</div>

来自

http://twitter.github.com/bootstrap/javascript.html#modals

当页面第一次加载时,模态框立即出现。我没有 javascript 来触发它。他们网站上的现场演示并非如此。有什么遗漏吗?

【问题讨论】:

    标签: javascript twitter-bootstrap modal-dialog


    【解决方案1】:

    hide 类添加到您的模式中。

    更新 在 B3 中,模式已被彻底改造。你不应该需要这个类。

    如果仍然显示,请确保您在 HTML 中使用了正确的语法。它应该默认隐藏。

    【讨论】:

    • 那行得通。谢谢。他们是否应该更新他们的文档?他们给出的示例和现场演示的行为不同。
    • 游戏迟到了,但想输入。语法是我的问题。在第一个 div 中,我有 class="modal-fade" 而不是 class="modal fade"。其他类有 -,所以我想我只是把它扔在那里。
    猜你喜欢
    • 1970-01-01
    • 2013-10-21
    • 1970-01-01
    • 2014-03-01
    • 2018-03-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多