]> git.mxchange.org Git - friendica.git/commitdiff
call resizeIframe() function until size is stable
authorFabrixxm <fabrix.xm@gmail.com>
Mon, 21 Dec 2015 15:41:55 +0000 (16:41 +0100)
committerFabrixxm <fabrix.xm@gmail.com>
Mon, 21 Dec 2015 15:41:55 +0000 (16:41 +0100)
(iframe content finished to load, hopefully)
should remove scrollbars on rich oembeds

js/main.js

index f67d7183cedabb5e476e094459c386592a070ff9..f106b3daf43e93141a24cf3bf68d4e60cde08d2f 100644 (file)
@@ -1,6 +1,21 @@
   function resizeIframe(obj) {
     obj.style.height = 0;
-    obj.style.height = obj.contentWindow.document.body.scrollHeight + 'px';
+       _resizeIframe(obj, 0);
+  }
+  
+  function _resizeIframe(obj, desth) {
+       var h = obj.style.height;
+       var ch = obj.contentWindow.document.body.scrollHeight + 'px';
+       if (h==ch) {
+               return;
+       }
+       console.log("_resizeIframe", obj, desth, ch);
+       if (desth!=ch) {
+               setTimeout(_resizeIframe, 500, obj, ch);
+       } else {
+               obj.style.height  = ch;
+               setTimeout(_resizeIframe, 1000, obj, ch);
+       }
   }
 
   function openClose(theID) {