airfranceklm / ng-lazy-image

Angular directive for loading responsive image when container (which is preventing reflow) is in viewport.
http://afklm.github.io/ng-lazy-image/
MIT License
351 stars 64 forks source link

Images not loaded when scrolling fast #59

Open maelfrize opened 8 years ago

maelfrize commented 8 years ago

First of all thanks for your great library.

I noticed that the images are not loaded when scrolling down fast and stopping abruptly. I have to scroll a little bit more again and only than the images are loaded.

Can you reproduce this behaviour? Any idea on how to fix this?

dmigliorisi commented 8 years ago

I've noticed this as well. Can reproduce it consistently but I'm not quite sure what the cause is.

horst80 commented 8 years ago

This seems to be caused by the debounce (added in https://github.com/afklm/ng-lazy-image/commit/a5f82f9850ab6ad1cc5ec0661647f0d060177cb8)

var _onViewChangeDebounced = srcSetService.debounce(_onViewChange, 300);

When not using the debounce function, I no longer see this issue

var _onViewChangeDebounced = _onViewChange;

dmigliorisi commented 8 years ago

@horst80 That worked for me as well. I don't really want to be messing with this code in my project. Hoping we can get an update that fixes this.

horst80 commented 8 years ago

@dmigliorisi , you could use version 0.2.3, the issues does not exist there.

barinali commented 7 years ago

@horst80 you're right about that lower version and its change. But there is another issue if you use version 0.2.3. Because if we don't use debounce/throttle, it causes performance issue. I think it will be better than current version when #65 is merged.

barinali commented 7 years ago

@horst80, @dmigliorisi we've merged #65. I think your issue would be fixed. If you can test your code with current version and verify this, we can close this issue.

Thanks,

horst80 commented 7 years ago

Hi @barinali , the scrolling still seems buggy to me, looking at this example:

http://afklm.github.io/ng-lazy-image/sample-repeat.html

When quickly scrolling down to the bottom, the images are not being loaded. They do become visible once you scroll up again a little bit. Are you able to reproduce this?

RustyDev commented 7 years ago

We're having this issue as well. Any update?

SquadraCorse commented 7 years ago

Do you set the container height with the css trick (Option to use aspect ratio's)? So even when image not being loaded at first the position is in the right place of the screen when it eventually calculates the position (on scroll stop)?

burakkirkil commented 7 years ago

I replaced throttle function with better one and just works in #68