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

Is there any way to handle broken images? #80

Open
AndrewEastwood opened this issue Mar 17, 2015 · 1 comment
Open

Is there any way to handle broken images? #80

AndrewEastwood opened this issue Mar 17, 2015 · 1 comment

Comments

@AndrewEastwood
Copy link

for example If this had property 'replaceBrokenImagesWith' I would set any default image to show in place of broken images.
it could be also callback function that is being invoked every time when error is occurred passing by broken image name and sets callback result into images' src attribute.

@MohamedAlaa
Copy link

@AndrewEastwood I did that may be it can help you:

echo.init({
      offset: 1000,
      throttle: 10,
      debounce: false,
      unload: false,
      callback: function(element, op) {
        element.onerror = function() {
          var ele = element;
          var notFoundClass = 'image-404';
          if (ele.className.indexOf(notFoundClass) == -1) {
            ele.src = 'data:image/png;base64,';
            ele.className = ele.className + ' ' + notFoundClass;
          }
        }
      }
    });

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

2 participants