iframe根据子frame的高度自动高度
<script type="text/javascript">
//光标移动到顶部
this.to_top=function(){
$("html,body").animate({scrollTop:0}, 500);
} this.setCwinHeight=function (iframeObj) { /* 8、获取iframe的高度
iframe.contentWindow.document.body.offsetHeight;
如果要获取iframe中的iframe
document.getElementById('iframId').onload=function(){
var html= window.frames["name属性"].frames["name属性"].document.getElementById('iframe中的元素的id').innerHTML; $('#iframeId').load(function() { //方法1
var iframeHeight = Math.min(iframe.contentWindow.window.document.documentElement.scrollHeight, iframe.contentWindow.window.document.body.scrollHeight);
var h=$(this).contents().height();
$(this).height(h+'px');
});
*/
if (document.getElementById) {
if (iframeObj && !window.opera) {
if (iframeObj.contentDocument
&& iframeObj.contentDocument.body.offsetHeight) {
if (a = iframeObj.getAttribute("id") == "video_top") {
iframeObj.height = iframeObj.contentWindow.document.body.offsetHeight;
} else if (iframeObj.getAttribute("id") == "video_bottom") {
iframeObj.height = iframeObj.contentWindow.document.body.offsetHeight;
} else if (document.frames[0].contentWindow
&& document.frames[0].contentWindow.document.body.scrollHeight) {
var height = document.frames[0].document.body.scrollHeight;
}
}
}
}
}
</script>
//src为子frame间接路径
<iframe id="video_bottom" src="${pageContext.request.contextPath}/vcomment/videoBottom/${videoId}.htm" width="90%" frameborder="0" scrolling="no" onload="setCwinHeight(this);"></iframe>
iframe根据子frame的高度自动高度的更多相关文章
- html中iframe根据子页面内容动态修改高度
JavaScript var browserVersion = window.navigator.userAgent.toUpperCase(); var isOpera = browserVersi ...
- iframe自动高度
<script> //设置iframe自动高度 function setIframe(id){ var fn = function(){ try{ var iframe = typeof ...
- (转载)html中div使用自动高度
为什么要使用div标签 1.更多的配置项,那就意味着更灵活,当然,难度也更高: 2.可以方便的容纳其他html标签: static定位就是不定位,出现在哪里就显示在哪里,这是默认取值,只有在你 ...
- 纯CSS实现侧边栏/分栏高度自动相等
by zhangxinxu from http://www.zhangxinxu.com本文地址:http://www.zhangxinxu.com/wordpress/?p=694 一.为何要分栏高 ...
- textarea宽度、高度自动适应处理方法
textarea自动高度 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http: ...
- css 子div自适应父div高度
<div class="out"> <div class="a"></div> <div class="b& ...
- 纯CSS兑现侧边栏/分栏高度自动相等(转)
这里直接介绍我认为的最佳的侧边栏/分栏高度自动相等方法.核心的CSS代码如下(数值不固定): margin-bottom:-3000px; padding-bottom:3000px; 再配合父标签的 ...
- KindEditor 销毁与自动高度冲突解决
前提准备情况: KindEditor(KE) + easyUI 1.通过 EasyUI.Window 打开一个窗口,窗口中包含一个 KE编辑器:在次打开WIndow 的时候 KE会出现编辑器里面的 ...
- 子元素浮动父容器高度不能自适应的CSS解决方法
百度标题:子元素浮动父容器高度不能自适应的CSS解决方法 从第二份工作开始,已经不怎么写样式了,然后就忘记了一部分,有的也生疏了. 今天碰到子元素意外挤到一起的问题,就问公司前端工程师是怎么回事,F1 ...
随机推荐
- Hive的架构(二)
02 Hive的架构 1.Hive的架构图 2.Hive的服务(角色) 1.用户访问接口 CLI(Command Line Interface):用户可以使用Hive自带的命令行接口执行Hive ...
- Directed Roads CodeForces - 711D (基环外向树 )
ZS the Coder and Chris the Baboon has explored Udayland for quite some time. They realize that it co ...
- CSS3参数matrix(n,n,n,n,n,n)定义 2D 转换,使用六个值的矩阵。那这六个值分别代表了什么参数?
matrix( a, b, c, d, e, f );a 水平缩放b 水平倾斜c 垂直倾斜d 垂直缩放e 水平移动f 垂直移动
- elk搭建的详细步骤以及说明
一:准备工作 1.准备一台虚拟机 192.168.175.222 elk-node2 2.关闭防火墙以及selinux 命令:systemctl stop firewalld # ...
- NOIP2018提高组初赛准备
NOIP2017提高组初赛错题 一.单项选择题(共15 题,每题1.5 分,共计22.5 分:每题有且仅有一个正确选项) 4. 2017年10月1日是星期日,1949年10月1日是( ). A. 星期 ...
- 动态添加+动态绑定(vue数据驱动思路)
先上案例 首先来分析一下,勾选科目的时候,下面同时增加科目的满分值设置. 以前写jquery的思路:当勾选的时候创建dom节点,然后把dom节点append到父节点上,项目采用前后分离的方式进行交互, ...
- java中list和map详解
一.概叙 List , Set, Map都是接口,前两个继承至Collection接口,Map为独立接口, List下有ArrayList,Vector,LinkedList Set下有HashSet ...
- 两种常用的数据交换格式:XML和JSON
不同编程语言之间的数据传输,需要一种通用的数据交换格式,它需要简洁.易于数据储存.快速读取,且独立于各种编程语言.我们往往传输的是文本文件,比如我们都知道的csv(comma seperated va ...
- org.springframework.web.servlet.view.ContentNegotiatingViewResolver
restful服务中一个重要的特性就是一种资源可以有多种表现形式,在springmvc中可以使用ContentNegotiatingViewResolver这个视图解析器来实现这种方式. 描述资源的三 ...
- Python简单雷达图绘制
import numpy as npimport matplotlib.pyplot as pltimport matplotlibmatplotlib.rcParams['font.family'] ...