在javascript,jQuery或css如何获得一个div或iframe展开以填补空间的余地 [英] In javascript, jQuery, or css how do I get a div or iframe to expand to fill rest of space

查看:190
本文介绍了在javascript,jQuery或css如何获得一个div或iframe展开以填补空间的余地的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有三个iframe,我将顶部的iframe设置为50px的高度,我将底部的iframe设置为50px,但我想要中间的iframe exand来填充剩余的空间。有没有技术,我可以使用来做任何窗口屏幕尺寸?
感谢。

I have three iframes and I set the top iframe to 50px height and I set the bottom iframe to 50px, but I want the middle iframe to exand to fill the rest of the space. Is there a technique I can use to do this for any window screen size? thanks.

例如:

<iframe style="width:100%; height:50px;" src="headerstuff.asp" %></iframe>
<iframe style="width:100%; height:100%;" src="Content.asp" %></iframe>  <!-- height needs to fill -->
<iframe style="width:100%; height:50px;" src="footerstuff.asp" %></iframe>


推荐答案

<iframe id="i1" style="width:100%; height:50px;" src="headerstuff.asp" %></iframe>
<iframe id="i2" style="width:100%; height:100%;" src="Content.asp" %></iframe>  <!-- height needs to fill -->
<iframe id="i3" style="width:100%; height:50px;" src="footerstuff.asp" %></iframe>

var res, ires,n1,n2,h;
n1 = $('#i1').height(); 
n2 =$('#i3').height();
h= $(window).height();
ires = n1+n2;
res = h-ires;

$('#i2').height(res);

这篇关于在javascript,jQuery或css如何获得一个div或iframe展开以填补空间的余地的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆