以下是我使用twitter bootstrap启动模式的代码。
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Twitter Bootstrap Modals Example</title>
<meta name="description" content="Creating Modal Window with Twitter Bootstrap">
<link href="assets/css/bootstrap.css" rel="stylesheet">
</head>
<body>
<div class="container">
<h2>Example of creating Modals with Twitter Bootstrap</h2>
<div id="example" class="modal hide fade in" style="display: none; ">
<div class="modal-header">
<a class="close" data-dismiss="modal">×</a>
<h3>This is a Modal Heading</h3>
</div>
<div class="modal-body">
<h4>Text in a modal</h4>
<p>You can add some text here.</p>
</div>
<div class="modal-footer">
<a href="#" class="btn btn-success">Call to action</a>
<a href="#" class="btn" data-dismiss="modal">Close</a>
</div>
</div>
<p><a data-toggle="modal" href="#example" class="btn btn-primary btn-large">Launch demo modal</a></p>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"> </script>
<!--<script src="assets/js/jquery.js"></script>-->
<script src="assets/js/bootstrap-modal.js"></script>
</body>
</html>
我不知道出了什么问题,但模态永远不会启动。所有发生的事情是“#modalname”被附加到地址栏中的url。我做错了什么?
答案 0 :(得分:0)
我和@salman在一起,我也没有看到任何问题。这是你的HTML的jsFiddle,唯一的区别是我从CDN加载javascript和CSS文件
http://jsfiddle.net/panchroma/fp4vu/
三重检查您的页面上是否确实加载了Bootstrap和CSS文件。如果仍然无法解决问题,请尝试从CDN加载它们
这是我用过的HTML
<div class="container">
<h2>Example of creating Modals with Twitter Bootstrap</h2>
<div id="example" class="modal hide fade in" style="display: none; ">
<div class="modal-header">
<a class="close" data-dismiss="modal">×</a>
<h3>This is a Modal Heading</h3>
</div>
<div class="modal-body">
<h4>Text in a modal</h4>
<p>You can add some text here.</p>
</div>
<div class="modal-footer">
<a href="#" class="btn btn-success">Call to action</a>
<a href="#" class="btn" data-dismiss="modal">Close</a>
</div>
</div>
<p><a data-toggle="modal" href="#example" class="btn btn-primary btn-large">Launch demo modal</a></p>
我正在从:
导入javascript和csshttp://netdna.bootstrapcdn.com/twitter-bootstrap/2.2.2/css/bootstrap-combined.min.css 和
http://netdna.bootstrapcdn.com/twitter-bootstrap/2.2.2/js/bootstrap.min.js
祝你好运!答案 1 :(得分:0)
如果任何其他css属性可能覆盖您的引导类,请查看。