我在同一页面上有两个iframe,但加载时间不同 [英] I have two iframe on same page but it load in different time duration

查看:197
本文介绍了我在同一页面上有两个iframe,但加载时间不同的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在同一页面上有两个或多个iframe.我必须一次加载所有iframe并同时显示.目前,它一个接一个地加载.我想一次全部加载,并与页面加载异步.

I have two or more iframe on the same page. I have to load all iframe at once and appear in same time. Currently it loaded one by one. I want to load all at once and asynchronous with page loading.

推荐答案

我的解决方案:

  • 首先将隐藏的CSS添加到所有iframe中.
  • 然后在每个iframe上使用onload方法.这种方法会增加一些 类,例如loaded并检查是否完成所有iframe的操作 这个班.
  • 如果没有-不执行任何操作,否则显示所有iframe.
  • My solution:

    • First add hidden css to all iframe's.
    • Then use onload method on each iframe. This method will add some classes for example loaded and check on finish is all iframe has this class.
    • If don't have - do nothing, otherwise show all iframes.
    • 在这里您可以找到用法onload方法的示例:演示

      Here you can find example of usage onload method: demo

      这篇关于我在同一页面上有两个iframe,但加载时间不同的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆