[英]Too much html element slow down jquery
I have a js script to get a datafeed and built some div according to the response text. 我有一个js脚本来获取数据源并根据响应文本构建一些div。
I have already used web worker and ajax to split the read datafeed and build html code process. 我已经使用了web worker和ajax来拆分读取数据源并构建html代码进程。
However while I append the html to my container, it becomes slow (let say 18000's div) 然而,当我将html附加到我的容器时,它变得很慢(比如18000的div)
Then I change the method to append the 200 div for scroll to down of my container. 然后我更改方法以附加200 div以滚动到我的容器的下方。
It becomes very fast, but while all items render, the other process start to become slow, for example if I make the container show and hide, it is pretty slow. 它变得非常快,但是当所有项目都渲染时,另一个进程开始变慢,例如,如果我让容器显示和隐藏,那么它很慢。
I found another solution is to use z-index, it makes the show hide process much faster. 我发现另一个解决方案是使用z-index,它使show hide进程更快。
However, while I need to change the container content, it becomes slow again. 但是,虽然我需要更改容器内容,但它会再次变慢。
Any idea or solution? 任何想法或解决方案?
在实时DOM结构之外执行尽可能多的更改将提高性能。要了解更多信息,请查看如何在页面中提高java脚本的性能?
I have been in this similar situation, where I was adding lot of child's to a node in a tree. 我一直处于类似的情况,在那里我将很多孩子添加到树中的节点。
Problems 问题
Solutions 解决方案
There are lot of things that can be done tom improve this. 汤姆可以做很多事情来改善这一点。 If you can post a jsfiddle for this will certainly help.
如果你可以发布一个jsfiddle,这肯定会有所帮助。
问题解决了SlickGrid可以轻松处理的问题
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.