简体   繁体   English

iframe 加载太快

[英]Iframe Load Too FAST

I setup script to load my iframe but i see that script load to fast iframe content, i dont know how can setup to backgound load all css images content and then show full iframe content?我设置脚本来加载 iframe,但我看到脚本加载到快速 iframe 内容,我不知道如何设置后台加载所有 css 图像内容,然后显示完整的 iframe 内容?

My code:我的代码:

<style>
#test123 {
  display: none;
}
</style>
<script>
jQuery(document).ready(function( $ ){
$('iframe').on('load', function() {
    jQuery("#test123").css("display","block");
},)
});
</script>
<iframe id="test123" src="https://www.mydomain.co/iframe" height="200" width="300"></iframe>

Why don´t you try a setTimeOut function to delay the iframe?为什么不尝试使用 setTimeOut 函数来延迟 iframe? Not fancy, but it should work.不花哨,但它应该工作。

<script>
jQuery(document).ready(function( $ ){
   $('iframe').on('load', function() {
      setTimeout(function () {
         jQuery("#test123").css("display","block");
      }, 2000); // 2 seconds
   },)
});
</script>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM