以下是Bootstrap文档中给出的“静态模态框”的实例
<div class="modal fade" id="myModal">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">
<span aria-hidden="true">×</span><span class="sr-only">Close</span>
</button>
<h4 class="modal-title">Modal title</h4>
</div>
<div class="modal-body">
<p>One fine body…</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary">Save changes</button>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
但是,运行之后,静态模态框并加载不出来,调查之后发现,需要加上以下代码:
<script>
$(document).ready(function(){
$('#myModal').modal('show');
})
</script>
这样就可以正常显示啦~~~
版权声明:本文为wenyun_kang原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。