iframe 内の要素が画面に表示されるかどうかを判断する必要があります。(画面の表示部分にある場合)ページが非常に長くなる可能性があり、ユーザーがスクロールして要素を表示する必要があることを意味します
index.html:
<html>
...
...
<iframe src="iframe.html" />
...
...
</html>
iframe.html:
<html>
...
...
<div id="element"></div>
....
...
<script type="text/javascript">
var el = document.getElementById('element');
if (isElementVisible(el)) {
// do something
}
</script>
</html>
そのような関数 isElementVisible() の書き方は?