<iframe id="iframe" onLoad="AutoFit();" frameborder="0" scrolling="no" src="http://www.cnblogs.com">
</iframe>

JQuery代码:

function AutoFit() {
var ifm = document.getElementById("iframe");
var subWeb = document.frames ? document.frames["article_frame"].document : ifm.contentDocument;
if (ifm != null && subWeb != null) {
    $("#iframe").css({ "width": subWeb.body.scrollWidth + "px" });
    $("#iframe").css({ "height": subWeb.body.scrollHeight + "px" }); 
  }
}

[转]iframe自适应宽度高度的更多相关文章

  1. jquery库实现iframe自适应内容高度和宽度

    javascript原生和jquery库实现iframe自适应内容高度和宽度---推荐使用jQuery的代码! ‍<iframe src="index.php" id=&qu ...

  2. iframe 自适应内容高度

    在使用iframe的时候,会出现iframe不能随着内容的高度自动改变的情况,下面就介绍一种可以自适应高度的办法.<br/> <pre> <iframe id=" ...

  3. storyboard xib下label怎么自适应宽度高度

    先看需求:两个Label,要求蓝色的label紧跟在红色的label文字后面  ok首选正常添加约束 红色的Label添加宽度,高度,左边,上边约束 蓝色的Label添加宽度,高度,左边,和红色的水平 ...

  4. iOSstoryboard xib下label怎么自适应宽度高度

    先看需求:两个Label,要求蓝色的label紧跟在红色的label文字后面 ok首选正常添加约束 红色的Label添加宽度,高度,左边,上边约束 蓝色的Label添加宽度,高度,左边,和红色的水平对 ...

  5. iframe自适应宽度

    <iframe id="course_content" style="width:100%;margin:5px 0 0;" scrolling=&quo ...

  6. eayui js动态加载Datagrid,自适应宽度,高度

    HTML: <div class="easyui-layout" style="min-height:100%;min-width:100%;"> ...

  7. jquery iframe自适应高度[转]

      经典代码 iFrame 自适应高度,在IE6/IE7/IE8/Firefox/Opera/Chrome/Safari通过测试. 很古老的方法: <iframe src="../In ...

  8. iframe自适应高度的问题

    最近工作中遇到了iframe自适应高度的问题. 如果在iframe中写定高度height的属性,并且iframe中内容高度小于给定的height时,会在手机浏览器中莫名的产生下拉框,造成体验度下降. ...

  9. iframe自适应高度处理

    一中方法: 在子页面加载完毕的时候执行 parent.document.getElementById("iframe").height=0; parent.document.get ...

随机推荐

  1. 323. Number of Connected Components in an Undirected Graph

    算连接的..那就是union find了 public class Solution { public int countComponents(int n, int[][] edges) { if(e ...

  2. 趣味理解ADO.NET对象模型

    为了更好地理解ADO.NET的架构模型的各个组成部分,我们可以对ADO.NET中的相关对象进行图示理解,如图所示的是ADO.NET中数据库对象的关系图. 讲究完关系图后,为了加深大家的理解,我们可以用 ...

  3. 深入了解VSTS的Unit Test测试属性

    深入的了解一下方法上带有的属性的含义.每个方法上几乎都带有TestMethod这个属性,我们直觉告诉我们,这肯定是表示被测试函数的意思.事实也正是如此,在Unit Test里,有许多测试属性,常用的如 ...

  4. iOS开发-No matching provisioning profiles found解决方法

    今天真机调试的时候莫名其妙遇到了这种一个问题: This product type must be built using a provisioning profile, however no pro ...

  5. java数组使用技巧

    参考网上文章,总结了一下java数组使用技巧,如下: package com.beijing.array; import java.nio.ByteBuffer; import java.util.A ...

  6. Java 理论与实践: 非阻塞算法简介--转载

    在不只一个线程访问一个互斥的变量时,所有线程都必须使用同步,否则就可能会发生一些非常糟糕的事情.Java 语言中主要的同步手段就是synchronized 关键字(也称为内在锁),它强制实行互斥,确保 ...

  7. SSL 错误

    javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection?    at com.sun.net.ssl.in ...

  8. ipad itunes 恢复

    http://jingyan.baidu.com/article/a3aad71aa58efbb1fa00967c.html http://act.feng.com/wetools/index.php ...

  9. Elasticsearch .Net Client NEST 多条件查询示例

    Elasticsearch .Net Client NEST 多条件查询示例 /// <summary> /// 多条件搜索例子 /// </summary> public c ...

  10. [Redis] C#中使用redis

    C#中使用redis 首先打开Visual Studio建立一个简单的控制台应用程序,我这里暂时使用的VS2013的版本. 然后通过Nuget进行安装Redis常用组件ServiceStack.Red ...