fanktom/angular-coverflow

Loading more images (lazy loading/unloading)

Closed this issue · 2 comments

I like your coverflow and the performance. I have worked with coverflow before (pure javascript/jquery) but now I am investigating the use of angularjs. As I am quite new to angular, I was wondering if it is possible to add lazy loading and unloading of images to this coverflow without losing performance.

For example: At loading of the page, load a number of images (say 50). when the user scrolls to the right, and reaches image 25, at the right side it should load another 25 images from the server, adding them to the coverflow. At the left side then 25 images should be removed. So at any time the coverflow does not contain more than 50 images (this may be 75 for a short moment when adding/removing images).

Thanks!

Yes, in general it is possible to add lazy loading. Depending on the current position and acceleration vector one can calculate the images to preload and then fetch them with the javascript image object. More complicated is getting rid of images as javascript is garbage collected so you can't exactly define what images to unload but have the garbage collector do the work.

In general I would build another module that does the preloading for you and not incorporate it into the coverflow. The input to that preloader wold be the coverflow, where you can watch the current position and acceleration vector.

If you come up with an implementation, I'd be happy to merge the pull-request.

I'd be happy to see this feature as an extra module - but probably this shouldn't be in the core. If you developed an algorithm for the lazy-loading an extra angular service module is probably the right container. I'd be happy to refer to it.