diff --git a/package.json b/package.json index 7f16c0c..f6d9e1b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "the-fold-within", - "version": "3.0.4", + "version": "3.0.5", "dependencies": { "pdf-parse": "^1.1.1" } diff --git a/public/app.js b/public/app.js index 16a00b1..a6fe9ce 100755 --- a/public/app.js +++ b/public/app.js @@ -294,11 +294,15 @@ function renderIframe(rel) { `; doc.head.appendChild(style); - // Inject auto-height script + // Inject auto-height script with debounce const script = doc.createElement("script"); script.textContent = ` + let timeout; function sendHeight() { - window.parent.postMessage({ type: 'resizeFrame', height: document.body.scrollHeight }, '*'); + clearTimeout(timeout); + timeout = setTimeout(() => { + window.parent.postMessage({ type: 'resizeFrame', height: document.body.scrollHeight + 20 }, '*'); + }, 100); } new ResizeObserver(sendHeight).observe(document.body); window.addEventListener('load', sendHeight);