From: Michael M Slusarz Date: Fri, 7 Jan 2011 19:07:49 +0000 (-0700) Subject: Resize IFRAME correctly if images are loading at injection time X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=de6616f74c08f054dae04035a497bbb4a21e0cf7;p=horde.git Resize IFRAME correctly if images are loading at injection time --- 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.