performance - jQuery / JS display large set of elements: show() vs append() -
<div class="snippet"> <p> 1</p> //dozens of elements here </div> <div class="snippet"> <p> 2</p> //dozens of elements here </div> .... <div class="snippet"> <p> ~200</p> //dozens of elements here </div>
between 100 , 200 divs created in steps i.e 1 one (with delay)
and displayed @ once in end. see 2 options:
- create hidden div(container) -> @ each step append div(snippet) -> div(container).show() once.
- store divs(snippet) without putting them in dom, @ end wrap them div(container) , append it.
what pros/cons of both , there better way? code run on low-power devices.
i know cost of touching dom. hope question helpfull in future.
Comments
Post a Comment