简体   繁体   English

页面完全重新渲染事件?

[英]Page fully re-rendered event?

I'm altering the DOM tree in plain JS and need to know when the changes get fully rendered on screen (mostly care about document dimensions). 我要在纯JS中更改DOM树,并且需要知道所做的更改何时在屏幕上完全呈现(主要是在乎文档的尺寸)。

window.onload=function(){
    ss = document.styleSheets[0];
    for(i = 0; i < ss.cssRules.length; i++) { ss.deleteRule(i) };
    ss.addRule('p', 'color: red;')
    // ... many more
    // call some other function when the page is fully rendered?
}

TIA. TIA。

why don't use jQuery ? 为什么不使用jQuery? it provides that functionality and can help you a lot. 它提供了该功能,可以为您提供很多帮助。

MyLibrary (ie your library) provides a documentready listener: MyLibrary(即您的库)提供了一个文档就绪的侦听器:

http://www.cinsoft.net/mylib-doc.asp#attachdocumentreadylistener > http://www.cinsoft.net/mylib-doc.asp#attachdocumentreadylistener>

Have settled on 已定居

window.setTimeout(function(){
// code
}, 50);

so far. 至今。

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

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