vue-lazyload icon indicating copy to clipboard operation
vue-lazyload copied to clipboard

lazy state not changing to loaded

Open 30capri opened this issue 5 years ago • 11 comments

I am loading a vue component, but the image lazy state is not changing to loaded, until and unless I am hovering over the component. The images are present in the viewport. The issue is observed even after the images have been downloaded. I am using the same component in other pages, but there the issue is not observed.

This is how it's used image

Here we are initializing it

Vue.use(VueLazyLoad, { loading: "./Default_Image.png", error: "./Default_Image.png" })

HTML image

The page on which we are using is displayed in a tab. I don't think that should be a problem though. Not able to figure out what is wrong. :(

30capri avatar Jul 18 '19 11:07 30capri

I am seeing the same issue in my project. My placeholder styling stays in place indefinitely, even after the image is loaded, but any hovering or scrolling events quickly changes the state and my image appears.

rickhall avatar Aug 23 '19 19:08 rickhall

@rickhall Are your images by any chance, in a page that is rendered before the user lands on it ?

30capri avatar Aug 24 '19 06:08 30capri

No.

You can see the same bug in this demo: http://hilongjw.github.io/vue-lazyload/

You can just keep clicking "Switch" until you see some images come up an remain the "spinner" icon. When that happens, then scroll the window and you'll see the actual image appear.

I just looks like the library is not reacting to load events properly.

rickhall avatar Aug 24 '19 18:08 rickhall

We are facing a similar issue. Did you manage to solve it?

joaobarcia avatar Apr 03 '20 09:04 joaobarcia

I'm not sure if it was fixed, since I moved away from the approach and did it a different way.

rickhall avatar Apr 03 '20 13:04 rickhall

Thanks for the reply @rickhall ! I also managed to workaround it by changing some if conditions on our code.

While trying to fix it, I had the impression that changing the options attempt and throttleWait had an impact on it. Don't know if that's helpful for anyone trying to fix it in the future.

joaobarcia avatar Apr 03 '20 13:04 joaobarcia

I was having the same issue as @rickhall . setting observer: true appears to solve it for me.

tarponjargon avatar Dec 11 '20 05:12 tarponjargon

The fact that this issue is clearly visible in the demo is sort of a hint that it is a bug. It would be nice to have it fixed, but I just implemented lazy loading myself, since it is not that difficult to do.

rickhall avatar Dec 11 '20 13:12 rickhall

@rickhall Yeah I think this repo might not be maintained anymore. Would you be able to share your solution?

tarponjargon avatar Dec 11 '20 16:12 tarponjargon

@tarponjargon I didn't create a generic component, I just did something specific for my situation. Effectively, I just used a class marker to mark my non-rendered elements, listened for scroll and window resize events, when I received events, checked if the bounding box of any non-rendered elements intersected the visible viewport, if so I loaded its image and removed the non-rendered marker.

rickhall avatar Dec 11 '20 16:12 rickhall

@rickhall thanks for the info

tarponjargon avatar Dec 11 '20 17:12 tarponjargon