【发布时间】:2021-09-01 10:25:38
【问题描述】:
我正在检测我的内容是否在 iframe 之外。我一直在尝试一个直截了当的案例,但仍然无法检测到,基本上我正在填充 iframe,以便 iFrame 内的文档超出它的正文。
不知何故,我需要我的文档说“嘿,我在 iframe 的视口之外”。
已尝试使用文档的 clientHeight、BoundingClientRect()、visibilityState,但似乎没有任何效果。添加示例:
<html>
<head></head>
<body>
<b>iframe-4 includes the ad-iframe</b>
<iframe style="overflow:hidden; height:400px; width:400px; padding-left:700px; padding-top:750px" src="simpleHtmlDocWithoutAnyFancyStuff.html" scrolling="no">
</body>
</html>
【问题讨论】:
标签: javascript html iframe intersection-observer getboundingclientrect