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

Check if Default image is loaded or not #522

Open
elkhalifte opened this issue Jun 18, 2021 · 7 comments
Open

Check if Default image is loaded or not #522

elkhalifte opened this issue Jun 18, 2021 · 7 comments

Comments

@elkhalifte
Copy link

how can i check if the default image is loaded or failed.

from onStateChange i can only know if the lazyload image is loaded or not.
i want to do the same for the default image

@tjoskar
Copy link
Owner

tjoskar commented Jul 3, 2021

Hi @elkhalifte,

Right now, you can't, unfortunately. The idea on my part was that default image should only be used with an image you know exist and know the dimension of.

Have you solved this in another way? Or is this still an issue for you? I believe it would be possible to implement this feature if you still have the need for it.

@elkhalifte
Copy link
Author

Hi @tjoskar ,
Yeah i really need this feature . Thank you for this amazing package 😊

@elkhalifte
Copy link
Author

elkhalifte commented Jul 14, 2021

Any news @tjoskar :)

@tjoskar
Copy link
Owner

tjoskar commented Jul 18, 2021

No, not really. This is not easy since the default image is loaded by the browser with the "src" attribute.

What should happen if the default image could not be loaded but the lazyloaded image could be loaded?

Would this be acceptable:

console.log(event.reason);
// output:
// setup
// observer-emit
// start-loading
// mount-image
// loading-succeeded
// default-image-failed

// or:
// setup
// observer-emit
// start-loading
// mount-image
// default-image-failed
// loading-succeeded

// or:
// setup
// observer-emit
// start-loading
// mount-image
// default-image-failed
// loading-failed

@elkhalifte
Copy link
Author

Yeah , i think this would work for me.

@tjoskar tjoskar reopened this Jul 22, 2021
@elkhalifte
Copy link
Author

// setup
// observer-emit
// start-loading
// mount-image
// default-image-failed
// loading-succeeded

@rafa-suagu
Copy link

I think that can be achieved with the onload js native event.

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

No branches or pull requests

3 participants