update method of communication between iframe and embed script

This commit is contained in:
igoradamenko
2018-02-16 00:07:17 +02:00
parent 1e4704d01e
commit fdc3188155
2 changed files with 19 additions and 8 deletions
+9
View File
@@ -9,5 +9,14 @@
<body>
<div id="remark42"></div>
<script type="text/javascript" src="/web/remark.js"></script>
<script>
var lastHeight = 0;
setInterval(() => {
if (document.body.offsetHeight !== lastHeight) {
lastHeight = document.body.offsetHeight;
window.parent.postMessage(JSON.stringify({ remarkIframeHeight: lastHeight }), '*');
}
}, 200);
</script>
</body>
</html>