HN2new | past | comments | ask | show | jobs | submitlogin

There is: give the list a fixed height and a scrollbar to display more. Load the first two or so pages immediately and render them, then request more right away (or as the user scrolls, if they scroll faster than you can load them). As the user scrolls, remove dom elements that are more than a page above or below the visible area to keep the number of nodes small. Obviously, cache the data (and the removed nodes) so that when the user scrolls back to the same spot you can load them again quickly.

If performance is important and you have a lot of data, this is an enormously tricky thing to get right, and perhaps impossible in a general case.

Note that fast scrolling of lots of data is a little-noticed but extremely optimized operation in the OS X and iPhone UI, and has undoubtedly received multiple man-years of attention.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: