简体   繁体   中英

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?

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? 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>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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