简体   繁体   English

检测何时完全渲染iframe和元素,而不仅仅是加载html

[英]Detect when iframe & elements are completely rendered, not just html is loaded

So i have an embedded iframe and i need to detect when the elements are completely rendered. 所以我有一个嵌入式iframe,我需要检测何时完全渲染了元素。 The jquery load() and ready() events only detect when the html is loaded and fire immediately without waiting for the iframe contents to render. jQuery load()和ready()事件仅检测html何时加载并立即触发,而无需等待iframe内容呈现。

i need to change the size & position of some elements via jquery, but jquery isn't accessing them. 我需要通过jquery更改某些元素的大小和位置,但是jquery无法访问它们。 I think the reason it can't access the elements in the iframe is because when the jquery file is ran, the elements aren't rendered yet. 我认为它无法访问iframe中的元素的原因是,当运行jquery文件时,尚未渲染这些元素。

window.onload=function(){
    var iframe=document.getElementById('iframeWrapper');
    iframe.onload=function(){
        console.log('laod the iframe')
    };
};

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM