文档加载时可见的Bootstrap模式

时间:2012-09-27 10:40:38

标签: twitter-bootstrap modal-dialog

我有一个Bootstrap模型工作正常,除了文档加载时它是可见的,我无法弄清楚如何使初始状态不可见?

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


<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>

2 个答案:

答案 0 :(得分:12)

根据文档,将hide类添加到模式中。

<div class="modal hide fade">
    ...
</div>

答案 1 :(得分:2)

原来只需将style="display: none"添加到模态外部div即可。