From 4b1c4dd3e51c49ec774168fd6502c2fb95c5f7d7 Mon Sep 17 00:00:00 2001 From: Michael M Slusarz Date: Fri, 12 Nov 2010 14:42:20 -0700 Subject: [PATCH] Keep tweaking IFRAME resizing --- imp/js/imp.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/imp/js/imp.js b/imp/js/imp.js index 49f854bfa..a08462b5f 100644 --- a/imp/js/imp.js +++ b/imp/js/imp.js @@ -94,14 +94,18 @@ document.observe('dom:loaded', function() { if (id = $(id)) { lc = id.contentWindow.document.lastChild; - id.setStyle({ height: Math.max(id.contentWindow.document.body.scrollHeight, lc.scrollHeight) + 'px' }); + id.setStyle({ height: 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.clientHeight != lc.clientHeight) { - id.setStyle({ height: Math.max(lc.clientHeight, lc.scrollHeight) + 'px' }); + id.setStyle({ height: lc.scrollHeight + 'px' }); + if (lc.clientHeight != lc.scrollHeight) { + // Finally, brute force if it still isn't working. + id.setStyle({ height: (lc.scrollHeight + 25) + 'px' }); + } } } }; -- 2.11.0