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.
精彩评论