我有一个在模态内部打开的表单页面,但是当我打开模态时,表单看起来并不完整,模态削减了一部分,模态是否有可能获得页面大小?
html
<!-- Modal -->
<div class="modal fade" id="exampleModal1" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel1" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header bg-warning text-white">
<h3 class="modal-title" id="exampleModalLabel1">Change, Update Wallet</h3>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<div class="embed-responsive embed-responsive-16by9">
<iframe id="iframeModal1" class="embed-responsive-item" src=""></iframe>
</div>
</div>
</div>
</div>
</div>
<!--end modal -->
-编辑
解决了!我通过放置
<br>
<br>
答案 0 :(得分:0)
您使用embed-responsive-16by9
(16:9)仅在您提供的内容不超过此比例时有效。
可能的解决方案是添加一个侦听器以等待iframe加载:
首先删除embed-responsive-16by9
然后将周围的容器的高度设置为iframe的高度
$('iframeModal1').on('load', function({
$('.embed-responsive').height($(this).contents().height());
});
您可能想再次设置高度,以防窗户尺寸改变(肖像/风景)
$(window).on('resize', ... )