Pentiado / angular-lazy-img

Lightweight lazy load images plugin. Only 1kb after gziping. Pure JavaScript, only Angular as dependency.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

In Firefox the script goes unresponsive if we have around 900 images using lazyImg

hassanakhtar opened this issue · comments

I think lazyImg:refresh is being called more than it is supposed to be.

Scenario:
If I have around 100 images loaded using lazyImg and I navigate to a different view and then come back again to the same view. The linking of the directive is done again and so this time, when the lazyImg:refresh event is triggered, the observer ($rootScope.$on('lazyImg:refresh'...) is called 200 times, then 300 and so on.

This becomes a problem when I have around 900 images on page and so the refresh grows like 900, 1800, 2700 and so on.

I am not sure about the threshold, but I observe this unresponsiveness when I have 920 images and I navigate to/away the page more than 3 times.