Is there any way to handle broken images?
AndrewEastwood opened this issue · comments
Andy Eastwood commented
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.
Mohamed A. Hassan commented
@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;
}
}
}
});