From 7965f72c8c42c5dac8c954ca446d806fb2c83104 Mon Sep 17 00:00:00 2001 From: fabrixxm Date: Mon, 28 Dec 2015 18:27:24 +0100 Subject: [PATCH] don't resize iframe if we can't find a final size greater than 0 --- js/main.js | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/js/main.js b/js/main.js index f106b3daf..ca4cc770c 100644 --- a/js/main.js +++ b/js/main.js @@ -1,22 +1,22 @@ - function resizeIframe(obj) { - obj.style.height = 0; - _resizeIframe(obj, 0); - } - - function _resizeIframe(obj, desth) { - var h = obj.style.height; - var ch = obj.contentWindow.document.body.scrollHeight + 'px'; - if (h==ch) { - return; + function resizeIframe(obj) { + //obj.style.height = 0; + _resizeIframe(obj, 0); } - console.log("_resizeIframe", obj, desth, ch); - if (desth!=ch) { - setTimeout(_resizeIframe, 500, obj, ch); - } else { - obj.style.height = ch; - setTimeout(_resizeIframe, 1000, obj, ch); + + function _resizeIframe(obj, desth) { + var h = obj.style.height; + var ch = obj.contentWindow.document.body.scrollHeight + 'px'; + if (h==ch) { + return; + } + console.log("_resizeIframe", obj, desth, ch); + if (desth!=ch) { + setTimeout(_resizeIframe, 500, obj, ch); + } else { + if (ch>0) obj.style.height = ch; + setTimeout(_resizeIframe, 1000, obj, ch); + } } - } function openClose(theID) { if(document.getElementById(theID).style.display == "block") {