我知道这个问题之前已被问过数百次,而且我已经通过了这些问题,但那些问题无法解决我的问题:s
到目前为止这是我的代码
<link href="bootstrap/css/bootstrap.min.css" rel="stylesheet" media="screen"> <link rel="stylesheet" type="text/css" href="style.css"> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script> <script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js"> <script src="http://maps.googleapis.com/maps/api/js?key=AIzaSyDY0kkJiTPVd2U7aTOAwhc9ySH6oHxOIYM&sensor=false"></script> <link href="bootstrap/js/bootstrap.min.js" rel="stylesheet" media="screen"> <link href="bootstrap/js/bootstrap-modal.js" rel="stylesheet" media="screen"> <link href="bootstrap/js/bootstrap-transition.js" rel="stylesheet" media="screen">
在体内,我有这个:
<a href="#myModal" role="button" class="btn" data-toggle="modal">Launch demo modal</a> <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>
请注意,我在头部使用了一些其他库,因为我需要它们用于谷歌地图,我试图删除它们但仍然没有触发模态视图.
解决方法
将此行添加到Javascript文件
$(document).ready(function() { $("#MyModal").modal(); });
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。