blob: 3676760e356eda9f896ab1f86be753cef36e0757 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
<!DOCTYPE html>
<div id="target" style="height: 100px; background-color: green;"></div>
<script>
const observer = new IntersectionObserver(records => {
records.forEach(record => {
if (record.isIntersecting) {
window.top.postMessage(record.isIntersecting, "*");
}
});
}, {});
observer.observe(target);
window.addEventListener("load", () => {
window.top.postMessage("ready", "*");
});
</script>
|