javascript - 检测 <iframe> 父元素何时从隐藏更改为显示

标签 javascript jquery iframe reload detect

如何检测 iframe 何时从隐藏元素显示?

HTML:

<div style="display:none">
 <iframe></iframe>
</div>

所以当我显示 <div> 时通过 jQuery 通过 $('div').show(); , 如何检测重新加载此 iframe?

PS:检测应该在 iframe 文件内进行。

不是: $('div').show(function(){//do something});或这个 ? (现在我不确定)

最佳答案

$('div').show("slow",function(){
  var iframe = $(this).find("iframe");
   iframe.attr('src', "SOME_URL");
});

关于javascript - 检测 &lt;iframe&gt; 父元素何时从隐藏更改为显示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16359746/

相关文章:

javascript - rails +jQuery : Get the Value of an Item Inside a Table to Use in a Prepend Function

php - 单击同一按钮显示 Div 2 和隐藏 Div 1

javascript - 删除父容器

html - IE frameBorder替代方案

html - 如何将这些 iframe 属性更改为 CSS?

javascript - 3 个 iFrame,3 个链接 - 使用 onclick 显示 1 个 iFrame,同时隐藏其他 iFrame

javascript - 在 Node.js/Express 中,我如何 "download"一个页面并获取它的 HTML?

javascript - 需要删除对象数组中的重复项并将数组与 union USING JS 合并

javascript - 无法从数据属性解析 JSON

javascript - 我从 html select 调用 jquery 函数并访问 jquery 函数中的某些对象。但未定义