当前位置: 动力学知识库 > 问答 > 编程问答 >

performance - Jquery adding a lot Elements to DOM very slow

问题描述:

in my pages I am loading texts via ajax to static divs. Those text are a bit large, but chrome and FF don't have problem, It takes about 120 ms to load one very long. But in IE 9 the same text takes even 1900ms, which forced me to try to find out how to speed my project a bit up. And I would like to avoid loading my text by parts. So what are some advices to speed up loading and rendering large amount of dom elements? Will for example setting visibility of divs which are not in the view to hidden help?

P.S I am a bit confused of different browsers behavior, so sorry If my question is somehow inappropriate.

So this particular line okno.children("div.okno-text").html(text).scrollTop(0); takes 116ms in chrome and 1752 in IE

And in the text variable are many elements wrapped into one. So the question was if for exapmle setting visibility for half of them to hidden and after that use my code will speed it up or not

Thanks

分享给朋友:
您可能感兴趣的文章:
随机阅读: