From: Michael M Slusarz Date: Fri, 5 Nov 2010 17:45:04 +0000 (-0600) Subject: More IFRAME resizing tweaking X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=014052b4b5293d081c3079835577fdadba09d0f8;p=horde.git More IFRAME resizing tweaking --- diff --git a/imp/js/imp.js b/imp/js/imp.js index 5559d50c8..49f854bfa 100644 --- a/imp/js/imp.js +++ b/imp/js/imp.js @@ -90,18 +90,18 @@ document.observe('dom:loaded', function() { IMP.iframeResize = function(id) { - var lc, val; + var lc; if (id = $(id)) { lc = id.contentWindow.document.lastChild; - val = Math.max(id.contentWindow.document.body.scrollHeight, lc.scrollHeight); - id.setStyle({ height: val + 'px' }); + id.setStyle({ height: Math.max(id.contentWindow.document.body.scrollHeight, lc.scrollHeight) + 'px' }); // For whatever reason, browsers will report different heights // after the initial height setting. // Try expanding IFRAME if we detect a scroll. - if (lc.clientHeight != lc.scrollHeight) { - id.setStyle({ height: (val + 25) + 'px' }); + if (lc.clientHeight != lc.scrollHeight || + id.clientHeight != lc.clientHeight) { + id.setStyle({ height: Math.max(lc.clientHeight, lc.scrollHeight) + 'px' }); } } };