JSFiddle - React, Tailwind, and code Playground
HTML
<iframe id="one"></iframe>
<iframe id="two"></iframe>
CSS
body, html {
height: 5000%;
}
iframe {
position: relative;
top: 150px;
}
JavaScript
function run() {
var div = document.createElement('div'),
scrollY = 'no';
div.id = 'scrollY';
document.body.appendChild(div);
document.getElementById("scrollY").innerHTML = scrollY;
window.parent.addEventListener('scroll', function() {
scrollY = window.parent.pageYOffset;
document.getElementById("scrollY").innerHTML = scrollY;
});
}
frames[0].window.eval('(' + run.toString() + '())');
frames[1].window.eval('(' + run.toString() + '())');