Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lazy state not changing to loaded #384

Open
30capri opened this issue Jul 18, 2019 · 11 comments · May be fixed by iamstoick/contenta_vue_nuxt#21
Open

lazy state not changing to loaded #384

30capri opened this issue Jul 18, 2019 · 11 comments · May be fixed by iamstoick/contenta_vue_nuxt#21

Comments

@30capri
Copy link

30capri commented Jul 18, 2019

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. :(

@rickhall
Copy link

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.

@30capri
Copy link
Author

30capri commented Aug 24, 2019

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

@rickhall
Copy link

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.

@joaobarcia
Copy link

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

@rickhall
Copy link

rickhall commented Apr 3, 2020

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

@joaobarcia
Copy link

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.

@tarponjargon
Copy link

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

@rickhall
Copy link

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.

@tarponjargon
Copy link

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

@rickhall
Copy link

@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.

@tarponjargon
Copy link

@rickhall thanks for the info

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants