HTML iframe的自适应
来源:互联网 发布:七天网络查分网页登录 编辑:程序博客网 时间:2024/05/01 07:51
HTML代码:
<iframe marginwidth='0' width='1200px' hspace='0' vspace='0' frameborder='0' scrolling='auto' onload='startInit(this)' src="+showDataUrl+" />
然后通过JS来编写iframe的自适应:
//iframe自适应高度
function reinitIframe(obj)
{
var browserVersion= window.navigator.userAgent.toUpperCase();
try{
var iframe=obj;
var bHeight=0;
if(browserVersion.indexOf("CHROME")==-1 && browserVersion.indexOf("SAFARI")==-1)
bHeight=iframe.contentWindow.document.body.scrollHeight;
var dHeight=0;
if(browserVersion.indexOf("FIREFOX")!=-1)
dHeight=iframe.contentWindow.document.documentElement.offsetHeight + 20;
else if(browserVersion.indexOf("MSIE")==-1 && browserVersion.indexOf("OPERA")==-1)
dHeight=iframe.contentWindow.document.documentElement.scrollHeight;
else
bHeight=bHeight+3;
var height = Math.max(bHeight, dHeight)+40;
iframe.style.height=height+"px";
}catch (ex){}
}
//每隔100ms刷新一次
function startInit(obj)
{
window.setInterval(function(){
reinitIframe(obj);
},100);
}
- HTML iframe的自适应
- HTML的iframe标签自适应方法总汇
- html iframe高度自适应
- html <iframe>自适应高度
- html iframe自适应高度的多种方法方法小结
- iframe 的自适应高度
- iframe 的自适应高度
- iframe自适应的代码
- 自适应的iframe代码
- iframe的自适应高度
- Iframe的自适应问题解决
- iframe框架的自适应
- iframe的高度自适应
- iframe高度的自适应
- [HTML]让iframe随iframe的内容自适应宽度和高度
- 设置HTML中的Iframe框架自适应高度
- HTML教程:如何设置Iframe自适应高度
- HTML教程:如何设置Iframe自适应高度
- 上传jar包到nexus私服
- uC/OS-II源码分析(1)
- linux下 fork(),vfork(),clone()的用法及区别
- Codeforces Round #277.5 (Div. 2)A——SwapSort
- 保护眼睛颜色的RGB数值
- HTML iframe的自适应
- 第十八课 接口
- 为啥我的两个activity之间跳转失败
- CentOS6.5x86安装Elasticsearch
- 自定义View监听onKeyDown事件,View捕获焦点
- Linked List Cycle II (leetcode)
- iOS为imageView添加图片实现动画
- unity游戏开发中的有限状态机FSM经验
- Memcache在linux环境下的部署