So I have a list with several <li>
elements,
<ul>
<li>a</li>
<li>b</li>
<li>c</li>
<li>d</li>
<li>e</li>
<li>f</li>
<li>g</li>
<li>h</li>
</ul>
The context is I want to re-use li
elements across a 1,000 memory intensive list for iOS. The objective is to display first 4 elements, the rest 4 are hidden, the container displays 4 items at a time.
On scroll (button tap), I'm going to animate the list and slide in the other 4, and at the end of the animation, move the first 4 li
items towards the end of the list (and then reset the position to left: 0
for the ul
)
My question is how I can get a hold of first elements and add them towards the end in plain javascript. (I'm handling animation through TweenLite)
Bonus: if you can suggest some better optimization techniques or library when it comes to display numerous elements.