加载 iFrame 时如何显示加载消息? [英] How to display loading message when an iFrame is loading?

查看:18
本文介绍了加载 iFrame 时如何显示加载消息?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个加载第三方网站的 iframe,加载速度极慢.

I have an iframe that loads a third party website which is extremely slow to load.

有没有一种方法可以在 iframe 加载时显示加载消息,而用户看不到大的空白区域?

Is there a way I can display a loading message while that iframe loads the user doesn't see a large blank space?

PS.请注意,iframe 适用于第三方网站,因此我无法在其页面上修改/注入任何内容.

PS. Note that the iframe is for a third party website so I can't modify / inject anything on their page.

推荐答案

我做了以下 css 方法:

I have done the following css approach:

<div class="holds-the-iframe"><iframe here></iframe></div>

.holds-the-iframe {
  background:url(../images/loader.gif) center center no-repeat;
}

这篇关于加载 iFrame 时如何显示加载消息?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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