iframe中的fixed解决方案
来源:互联网 发布:windows to go u盘价格 编辑:程序博客网 时间:2024/04/30 03:13
各位朋友,大家好,在卡发的过程中遇到了iframe中子页面fixed失效的问题 现在来解决一下。
首先是一个a.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>JavaScript 仿LightBox内容显示效果</title>
<meta http-equiv="Content-Type" content="text/html; charset=gbk" />
</head>
<body style="width: 980px; background-color: white;">
<iframe id="main" name="main" width="980" scrolling="no" frameborder="0" src="bb.html"
onload="this.height=main.document.body.scrollHeight; this.width=main.document.body.scrollWidth;if(this.height < 410){this.height=410;}">
</iframe>
</body>
<script src="https://cdn.bootcss.com/jquery/2.1.4/jquery.js"></script>
</html>
然后是b.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>JavaScript 仿LightBox内容显示效果</title>
<meta http-equiv="Content-Type" content="text/html; charset=gbk" />
</head>
<body style="width: 980px; background-color: white;">
<!--模拟弹出窗口的那个div-->
<div style="width: 980px; height: 1000px;">
<div id="box" style="height: 50px; width: 50px; margin-top: 100px; margin-left: 400px; background: red; position: fixed; z-index:100000000">
aaaa
</div>
</div>
</body>
<script src="https://cdn.bootcss.com/jquery/2.1.4/jquery.js"></script>
这里注意一下:
<script type="text/javascript">
$(parent.window).scroll(function(){
$('#box').css({
top : $(parent.window).scrollTop()
});
});
</script>
</html>
这样红色方块在a.html中就不会随着滚动条而滚动了。
- iframe中的fixed解决方案
- ios下,iframe页面中的position:fixed定位布局错误
- IFRAME如何调用网页中的部分内容-解决方案
- iframe中position:fixed失效
- iframe子页面position的fixed
- 解决iframe中fixed失效问题
- IE6 fixed的完美解决方案
- IE6不支持position:fixed解决方案
- Iframe跨域Cookie解决方案
- iframe自适应高度解决方案
- iframe高度自适应解决方案
- iframe自适应高度解决方案
- iframe透明解决方案
- iframe自适应高度解决方案
- iframe跨域解决方案
- Iframe 高度自适应解决方案
- C#中的Unsafe和Fixed
- translate元素中的Position: fixed
- 由于实体类文件位置错误 导致tomcat 报 entity class not found
- Spring 常用注解
- 增删改查
- Java解析Json数据
- 动态规划(7)
- iframe中的fixed解决方案
- 0072 在Tomcat 8上布置drools workbench
- 在HTML页面中如何实现多个文件同时下载
- 学习Vue.js 基础第一节
- jquery增加,移除,修改一个html标签的class类名
- mysql别名的使用
- 动态规划(8)
- 书籍复印-LintCode
- SpringMVC与Struts2区别与比较总结