Browse Source

Hide iframe until it's loaded BT#15166

Julio Montoya 6 years ago
parent
commit
7dbff1af3e
1 changed files with 16 additions and 1 deletions
  1. 16 1
      main/document/showinframes.php

+ 16 - 1
main/document/showinframes.php

@@ -414,13 +414,28 @@ if ($execute_iframe) {
 
         echo $toolbar = Display::toolbarAction('actions-documents', [$actionsLeft]);
 
+        $translate = api_get_configuration_value('translate_html');
+        $display = '';
+        if ($translate) {
+            $display = ' display:none ';
+            echo "<script>
+                    function waitToLoad() {     
+                        $('#mainFrame').css('display', 'block');
+                    }
+                    $(function() {
+                        setTimeout(waitToLoad, 2000);
+                    });
+            </script>";
+        }
+
         echo '<iframe 
             id="mainFrame" 
             name="mainFrame" 
             border="0" 
             frameborder="0" 
             scrolling="no" 
-            style="width:100%;" height="600" 
+            style="width:100%; '.$display.'" 
+            height="600" 
             src="'.$file_url_web.'&rand='.mt_rand(1, 10000).'" 
             height="500" allowfullscreen="true" webkitallowfullscreen="true" mozallowfullscreen="true"></iframe>';
     }