我正在尝试使用Bootstrap模式.我已经导入了bootstrap-modal.js
我需要使用按钮属性而不是JS来触发模态.
这是我的代码,它不允许模态工作!
<!-- Button to trigger modal -->
<a href="#myModal" role="button" class="btn" data-toggle="modal">Launch demo modal</a>
<!-- 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>
Run Code Online (Sandbox Code Playgroud)
Roh*_*ith 11
您的代码运行正常.您还应该将Jquery包含在您的页面中.在导入bootstrap.js之前添加它
<script src="http://code.jquery.com/jquery-latest.js"></script>
Run Code Online (Sandbox Code Playgroud)
另外不要忘记在head部分中链接bootstrap css文件.
<link href="css/bootstrap.min.css" rel="stylesheet" media="screen">
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
10245 次 |
| 最近记录: |