我在rails应用程序中使用bootstrap。我尝试使用bootstrap- me显示对话框,但是对话框不适合我。这是我的视图代码。
<div id="creative_attachment_popup" class="modal hide fade" role="dialog">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3>Modal header</h3>
</div>
<div class="modal-body">
<p>Do you eant to continue../p>
</div>
<div class="modal-footer">
<a href="#" class="btn">Close</a>
<a href="#" class="btn btn-primary">Save changes</a>
</div>
</div>简单地说,我将js文件称为
$('#creative_attachment_popup').modal('show');上面的代码只显示了一个淡入淡出的页面,不包含任何对话框。当我在控制台中输入上面的js行时,它会显示以下内容:
<div id="creative_attachment_popup" class="modal hide fade in ui-dialog-content ui-widget-content" role="dialog"> <h1 style="display: block;" aria-hidden="false">…</div>用我的html引用上面的代码。为什么我会得到这个?
发布于 2013-09-03 09:50:43
您必须在之前包含jQuery.js,然后包含bootstrap.js!!
并且对于脚本,不要使用简化形式的html。(像<script src=""/> )你必须像<script src=""></script>一样关闭它)
<!-- JQuery -->
<script type='text/javascript' src='http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js'></script>
<script type='text/javascript' src='http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js'></script>
<link rel="stylesheet" type="text/css" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css">
<!-- BootStrap Link -->
<link rel="stylesheet" type="text/css" href="/linker/styles/vendor/bootstrap.css">
<script type="text/javascript" src="/linker/js/vendor/bootstrap.js"></script>在文档准备好之后,您调用过$('#creative_attachment_popup').modal('show');吗?
$(function() {
$('#creative_attachment_popup').modal('show');
});发布于 2013-05-24 16:25:30
检查以下内容:
我将您的代码复制并粘贴到一个空白页中,然后添加了以下标题:
<link href="bootstrap.css" media="screen" rel="stylesheet" type="text/css" />
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script src="bootstrap.js" type="text/javascript"></script>然后我跑了
$('#creative_attachment_popup').modal('show');上面什么都有的奖牌弹出窗口。所以我猜你可能不会包含所有的东西(或者包含一些错误的东西)。
https://stackoverflow.com/questions/16729464
复制相似问题