From de6616f74c08f054dae04035a497bbb4a21e0cf7 Mon Sep 17 00:00:00 2001 From: Michael M Slusarz Date: Fri, 7 Jan 2011 12:07:49 -0700 Subject: [PATCH] Resize IFRAME correctly if images are loading at injection time --- imp/js/imp.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/imp/js/imp.js b/imp/js/imp.js index bad791d08..9474ac6ea 100644 --- a/imp/js/imp.js +++ b/imp/js/imp.js @@ -80,18 +80,19 @@ document.observe('dom:loaded', function() { id = $(id); var d = id.contentWindow.document; + id.observe('load', IMP.iframeResize.bind(IMP, id)); + d.open(); d.write(data); d.close(); id.show().previous().remove(); - this.iframeResize(id); }; IMP.iframeResize = function(id) { if (id = $(id)) { - id.setStyle({ height: id.contentWindow.document.lastChild.scrollHeight + 'px' }); + id.stopObserving('load').setStyle({ height: id.contentWindow.document.lastChild.scrollHeight + 'px' }); // For whatever reason, browsers will report different heights // after the initial height setting. -- 2.11.0