开发者

Page fully re-rendered event?

开发者 https://www.devze.com 2022-12-30 07:08 出处:网络
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).

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).

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

TIA.


why don't use jQuery ? it provides that functionality and can help you a lot.


MyLibrary (i.e. your library) provides a documentready listener:

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


Have settled on

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

so far.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号