From 014052b4b5293d081c3079835577fdadba09d0f8 Mon Sep 17 00:00:00 2001 From: Michael M Slusarz Date: Fri, 5 Nov 2010 11:45:04 -0600 Subject: [PATCH] More IFRAME resizing tweaking --- imp/js/imp.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) 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' }); } } }; -- 2.11.0