-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
onerror default image with 2.x #430
Comments
I am also really needing this feature to load a default image if the other images fail to load, still trying to figure out a solution here. |
I have updated the code to be able to handle loading a default image on error: https:/brianwozeniak/jquery_lazyload/blob/2.x/lazyload.js So for example:
If the image in data-src or data-srcset fail to load, then it will change back to the default src value. It does this by creating a data-original attribute when trying to load the other images. I also created a pull request to have this merged in. I also re-factored some duplicate code. |
Is there any way to load default image on error with 2.x version ? it was possible with 1.x version through setting error listener like following.
on("error", function() {
$self.attr("src","/resources/image/error.jpg");
})
how can i do that using div or img element with 2.x version ?
The text was updated successfully, but these errors were encountered: