[英]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.