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:

  1. create hidden div(container) -> @ each step append div(snippet) -> div(container).show() once.
  2. 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

Popular posts from this blog

java - SSE Emitter : Manage timeouts and complete() -

jquery - uncaught exception: DataTables Editor - remote hosting of code not allowed -

java - How to resolve error - package com.squareup.okhttp3 doesn't exist? -