iframe 标签自适应高度和宽度
iframe 结构如下
<iframe src="index.html" id="frame" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" onLoad="iFrameHeight()"></iframe>
js 实现
<script type="text/javascript" language="javascript">
function iFrameHeight() {
var ifm = document.getElementById("frame");
var subWeb = document.frames ? document.frames["frame"].document : ifm.contentDocument;
if (ifm != null && subWeb != null) {
ifm.height = subWeb.body.scrollHeight;
ifm.width = subWeb.body.scrollWidth;
}
}
</script>
jQuery 实现
$("#frame").load(function(){
var mainheight = $(this).contents().find("body").height()+30;
$(this).height(mainheight);
});
iframe 标签自适应高度和宽度的更多相关文章
- <iframe>标签自适应高度和宽度
<iframe src="index.html" id="iframepage" frameborder="0" scrolling= ...
- 关于使用iframe标签自适应高度的使用
在ifrome内设定最小高度,(此方法只适用于页面内切换高度不一.但是会保留最大高度,返回后保持最大高度不再回到最初页面的高度) <iframe id="one4" widt ...
- iOS之UILabel自适应高度、宽度
下列两条自适应高度和宽度的自定义方法:
- jQuery实现iframe的自适应高度
假设我们在当前页面要嵌套一个iframe 1 <iframe id="myframe" src="test.html" height="240& ...
- iframe框架自适应高度 uncanght SecurityError: Blocked a frame with origin "null" from accessing a frame ....
来源于crm项目的contact/edit.html 一.背景是这样的 最近在做crm系统的前端页面,有一个页面呢,点击“查看全部信息”时会弹出,这个弹窗里面又有分页导航,分页不是使用ajax 异步刷 ...
- iframe内容自适应高度
一直觉得要用JS才能实现iframe高度的自适应,其实CSS也可以,而且实现的更好,只是需要给包裹iframe的DIV设置个高度,然后让irame高度设置成100%就可以自适应了. 完美版Iframe ...
- UILabel 自适应高度,宽度
mLabel1 = [[UILabel alloc]initWithFrame:CGRectMake(0, 20, 10, 1)]; mLabel1.text = @"my label 1, ...
- input submit标签的高度和宽度与input text的差异
<input type="text"> 时设置input的高度和border,最后元素的高度和宽度包含了border的值. <input type="s ...
- iframe 自适应高度、宽度
示例: <iframe id="zyms" frameborder="0" scrolling="yes" style="w ...
随机推荐
- 如何为WPF添加Main()函数 程序入口点的修改
一般的.WPF的Main()函数是自动生成的,不过有时候我们需要为我们的应用程序传参.那么自动生成的Main()函数就不会满足我们的要求. 那么如何为WPF Application 设置Main()函 ...
- View not attached to window manager crash 的解决办法
View not attached to window manager crash 的解决办法 转自:http://stackoverflow.com/questions/22924825/view- ...
- Oleg Sych - » Pros and Cons of T4 in Visual Studio 2008
Oleg Sych - » Pros and Cons of T4 in Visual Studio 2008 Pros and Cons of T4 in Visual Studio 2008 Po ...
- Mac 下纯lua(三)
文件处理 直接使用io调用 io.close();文件流关闭 io.flush():如果文件流以bufferd缓存模式处理,输入不会立即存入文件,需要调用本函数 io.input(file):输入 i ...
- unity3d 捕获系统日志,来处理一些问题
注册系统日志回调,根据日志内容和类型处理一些特殊问题 using UnityEngine; using System.Collections; public class SetupVerificati ...
- Error:Execution failed for task ':app:dexDebug'. > com.android.ide.common.process.ProcessException
异常Log: Error:Execution failed for task ':app:dexDebug'. > com.android.ide.common.process.ProcessE ...
- SQL Server 添加一条数据获取自动增长列的几种方法
数据库表设计 邓老师(老邓教的) insert into TestOne ','Test011') select @@IDENTITY as '自动增长ID' 杨老师(老杨教的) insert ...
- 目标管理剖析与实践– 献给追梦的人 (转)
好久没写日志了. 最近总算在忙碌的日子中小小的松了一口气, 过来补起这几个月的空缺. 上次写的Cover Letter & Resume 重点诠释 - 深度剖析没想到居然超过了一万的阅读量 ...
- 转JS技巧
前端已经被玩儿坏了!像console.log()可以向控制台输出图片等炫酷的玩意已经不是什么新闻了,像用||操作符给变量赋默认值也是人尽皆知的旧闻了,今天看到Quora上一个帖子,瞬间又GET了好多前 ...
- Lowest Common Ancestor of a Binary Search Tree、Lowest Common Ancestor of a Binary Search Tree
1.Lowest Common Ancestor of a Binary Search Tree Total Accepted: 42225 Total Submissions: 111243 Dif ...