forcedotcom / scrollerjs

A JavaScript library that helps you build performant UI components for the web.
http://scrollerjs.com
Apache License 2.0
636 stars 63 forks source link

Surface pool wrong management #14

Closed sucotronic closed 9 years ago

sucotronic commented 9 years ago

With the example-carousel-indicator.html if you execute the following javascript:

for (var i=0; i<10000;i++)
    scroller.appendItems("<div>item"+i+"</div>")

and the user uses the scroll indicator multiple times to navigate, the pool is increased instead of being re-used (see video: http://tinypic.com/r/2utrrcn/8)

diervo commented 9 years ago

The problem is that the size of the items you are inserting is really small and therefore you need a lot of surface to fullfill the space till is time for shift or pop again. The pool management is correct. If you do this:

for (var i=0; i<10000;i++) {
    scroller.appendItems("<div style="width:320px">item"+i+"</div>");
}

You will see that the management is correct as well.