Twitter Bootstrap 2.1 - 模态无法正常工作

Mai*_*ein 11 html javascript css twitter-bootstrap twitter-bootstrap-2

我尝试集成twitter bootstrap模式但由于某种原因它不起作用.

问题是页面加载后会显示模态.

我写的是我的 <head>

   <script type="text/javascript">
    $('#myModal').modal({show: false,keyboard: false});
    </script>
Run Code Online (Sandbox Code Playgroud)

但是没有效果.

我使用的代码:(http://twitter.github.com/bootstrap/javascript.html#modals)

<-- 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>
Run Code Online (Sandbox Code Playgroud)

它在页面加载后直接呈现,如果我再次按下模态按钮它会消失,第二次出现但是整个页面变暗(即使模态本身也是暗色调)

有谁遇到过同样的问题?

我把它推到了heroku所以你可以看到问题.http://elobeast.com/ (右上角"启动演示模式")

And*_*ich 14

您需要将类添加.hide到模式的主容器中以隐藏它,直到调用它为止.