JS Iframe加载器 [英] JS Iframe loader

查看:83
本文介绍了JS Iframe加载器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找一种方法来使用jQuery / js在加载iframe时显示正在加载...消息,当iframe完成加载时,正在加载...文本应该消失。

I'm looking for a way to use jQuery/js to show a 'Loading...' message while an iframe is loading, when the iframe finished to load completely, the 'Loading...' text should disappear.

jquery / js可以吗?

Is that possible with jquery/js?

注意:我对网站内没有任何控制权iframe。

Note: I do not have any control on the website within the iframe.

推荐答案

<script>
function hide() {
  document.getElementById('loading').style.display='none';
}
</script>
<iframe onLoad="hide()" ... ></iframe>
<div id="loading">Please wait</div>

jquery:

$("iframe").load(function() { $("#loading").toggle()});

这篇关于JS Iframe加载器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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