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

Default response when image URL returns 404 #331

Open
abdfahim opened this issue May 7, 2016 · 3 comments
Open

Default response when image URL returns 404 #331

abdfahim opened this issue May 7, 2016 · 3 comments

Comments

@abdfahim
Copy link

abdfahim commented May 7, 2016

Hi,

I want the plugin to show a no image or some predefined default image when the src url returns none (404 error). Is it possible?

<img class="lazy" data-original="http://www.mydomain.com/noimage.jpg">

@ngoduykhanh
Copy link

I'm looking for this feature too.

@Jevirs
Copy link

Jevirs commented Sep 18, 2016

R.I.P

@Jevirs
Copy link

Jevirs commented Sep 18, 2016

OK,I got it.

  1. open this JS file https://github.com/tuupola/jquery_lazyload/blob/master/jquery.lazyload.js
  2. find line 129, add this .on("error", $self.attr("src","images/error.png})
  3. And it looks like
    .attr("src", $self.attr("data-" + settings.data_attribute))
    .on("error", function() { $self.attr("src","images/error.png"); })
    4.minify the JS file and enjoy

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