无法在bootstrap中运行Modal视图

时间:2013-09-19 14:43:49

标签: twitter-bootstrap modal-dialog

我在bootstrap网站上有这个例子:

启动演示模式

<!-- Modal -->
<div id="myModal" class="modal hide fade" 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>

我有这条线:

<link href="<?php echo base_url();?>assets/bootstrap/dist/css/bootstrap.css" rel="stylesheet">

在标签结束之前,我已经放置了这两行:

<script src="<?php echo base_url();?>assets/bootstrap/assets/js/jquery.js"></script>
<script src="<?php echo base_url();?>assets/bootstrap/dist/js/bootstrap.min.js"></script>

它坚持打开模态视图,它只是使背景突出显示为黑色,没有任何显示:s,我做错了什么?有什么想法吗?

1 个答案:

答案 0 :(得分:0)

你已经从引导文档中获取了JS输出的HTML,而不是所需的预渲染HTML。

<div id="myModal" class="modal hide fade">
  <div class="modal-header">
    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
    <h3>Modal header</h3>
  </div>
  <div class="modal-body">
    <p>One fine body…</p>
  </div>
  <div class="modal-footer">
    <a href="#" class="btn">Close</a>
    <a href="#" class="btn btn-primary">Save changes</a>
  </div>