Div 覆盖在 IFrame 顶部
Div overlay ontop IFrame
我一直在尝试让它工作一段时间了。这可能是一些微不足道的CSS。
图像不会覆盖页面顶部的 IFrame,而是直接拍摄到底部。
法典:
.overlay{
width: 100%;
height:100%;
position:relative;
}
.overlay1{
z-index: 1;
position:absolute;
left: 55%;
margin-right: -50%;
transform: translate(-50%, -50%);
width: 40px;
height: 20px;
background-color: rgba(0,0,0,0.5);
}
.frame {
width: 100%;
height: 100%;
}
<div class="overlay">
<iframe class="frame" allowtransparency="true" src="http://blah.com"></iframe>
<div class="overlay1">
<img src="http://www.ore-processing.com/d/images/livechat.png" class="my_popup_open"></img>
</div>
</div>
基本上,我正在尝试在IFrame上放置一个按钮,然后覆盖聊天窗口的弹出窗口(JQuery)。
提前谢谢你。
把你的覆盖div 放在 html 中的 iframe 下,而不是在它周围,用绝对位置和边距顶部减去一些数字将其拉起。
<iframe></iframe>
<div></div>
您必须
改用top: 0
将.overlay1
设置为顶部。
.overlay {
width: 100%;
height:100%;
position:relative;
}
.overlay1 {
z-index: 1;
position:absolute;
left: 55%;
margin-right: -50%;
transform: translate(-50%, -50%);
width: 40px;
height: 20px;
background-color: rgba(0,0,0,0.5);
top: 0;
}
.frame {
width: 100%;
height: 100%;
}
<div class="overlay">
<iframe class="frame" allowtransparency="true" src="http://blah.com"></iframe>
<div class="overlay1">
<img src="http://www.ore-processing.com/d/images/livechat.png" class="my_popup_open"></img>
</div>
</div>
只需添加top:0;
.overlay1 {
/* Your css */
top: 0;
}
添加position:absolute;
时,应使用 top, left, right and bottom
进行控制。
相关文章:
- 如何让iframe填充整个页面100%和顶部:4px
- 如何将元标记添加到最顶部的iFrame
- 绕过同源策略,从跨域iframe中获取页面的顶部URL
- 同一域链接正在顶部iFrame中加载,而不是在整个页面上加载
- 在移动应用程序上滚动iframe会在某个时刻跳到页面顶部
- Facebook iFrame选项卡-滚动到顶部
- 将IFrame滚动到顶部在Chrome中不起作用
- 如何使父网页从 iframe 滚动到特定位置(顶部)
- 使用 iframe 或灯箱将另一个页面堆叠在我的页面顶部
- 如何将Iframe粘贴在当前页面的顶部
- 可以 jQuery invalidHandler 通过父窗口中的 iframe 滚动顶部
- 滚动到 iframe 中数据表的顶部
- 防止 iframe 中的恶意 Flash 广告将用户重定向到顶部位置
- 发布到iframe,但iframe将顶部窗口重定向到操作url,而不是self
- 在iframe中滚动到顶部而不重新加载
- 使用iFrame调整器时,填充到调整大小的iFrame的顶部
- 如何获得iframe相对于顶部窗口的位置's视口
- 如何强制iframe'的父页面,当用户在iframe中导航时自动滚动到顶部
- 如何从顶部窗口触发事件到iframe
- 当加载新页面时,Facebook iframe不会显示在顶部