我正在尝试通过单击按钮来显示模式对话框。我正在尝试使用bootstrap。我的按钮没有正确设置样式(它应该是蓝色,但它只是一个链接),单击链接时不会显示模式对话框。单击按钮时屏幕变为灰色。模态的示例代码来自boot strap网站。我正在从CDN加载所有资源。这似乎并不困难。
http://jschr.github.io/bootstrap-modal/bs3.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Untitled Document</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js" type="text/javascript"></script>
<script src="http://netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
<link href="http://netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css" rel="stylesheet" media="screen">
</head>
<body>
<!-- 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>
</body>
</html>
答案 0 :(得分:4)
按钮默认类型=&gt; BTN-默认
<a href="#myModal" role="button" class="btn btn-default" data-toggle="modal">Launch demo modal</a>
忘记输入2个div'模态对话'和'模态内容'
<div class="modal-dialog">
<div class="modal-content">
从div'myModal'中删除隐藏
<div id="myModal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
答案 1 :(得分:1)
按钮在课程中添加btn-primary:class="btn btn-primary"
对于模态,请从类
中删除hide