[英]Run jQuery code once document is ready AND iframe content is loaded
[英]Execute jQuery once document is ready AND iframe content is loaded
正如您在此页面上看到的那样http://musicglaze.com/chase-status-let-you-go-feat-mali-feed-me-remix/#comments
评论部分是不合适的,经过研究我明白这是因为负责造型的插件( http://masonry.desandro.com/ )被调用
$(document).ready(function(){
});
功能。 然而,在此之后内容被加载到iframe中,因此改变其高度,但是当插件考虑其原始高度而没有内容时,一切都搞砸了。 有什么我可以使用的行为类似于这个伪代码?
Document ready AND iframe content loaded {
//My jQuery code
}
使用$('#iframeId').load(function() { ... });
而不是onReady
。 根本问题是允许父框架访问iframe内容存在跨域安全风险,因此onReady
不可用,但onLoad
仍然可访问。 有关详细信息,请参阅: http : //www.nczonline.net/blog/2009/09/15/iframes-onload-and-documentdomain/
相同的ready()函数
$(document).ready(function() {
$('#frameId').ready(function() {
...
});
})
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.