yet more IFRAME HTML tweaking
authorMichael M Slusarz <slusarz@curecanti.org>
Fri, 9 Oct 2009 22:34:06 +0000 (16:34 -0600)
committerMichael M Slusarz <slusarz@curecanti.org>
Sun, 11 Oct 2009 19:31:34 +0000 (13:31 -0600)
imp/js/imp.js

index 1f0cc27..c0fa935 100644 (file)
@@ -99,10 +99,12 @@ document.observe('dom:loaded', function() {
     IMP.iframeResize = function(id, defer)
     {
         id = $(id);
-        if (!defer && Prototype.Browser.IE) {
+        id.setStyle({ height: Math.max(id.contentWindow.document.body.scrollHeight, id.contentWindow.document.lastChild.scrollHeight) + 'px' });
+        if (!defer) {
+            // For whatever reason, browsers will report different heights
+            // after the initial height setting. Deferring a second height
+            // setting seems to work most of the time to fix this.
             this.iframeResize.bind(this, id, true).defer();
-        } else {
-            id.setStyle({ height: Math.max(id.contentWindow.document.body.offsetHeight, id.contentWindow.document.lastChild.offsetHeight) + 'px' });
         }
     };