diff --git a/jquery.lazyload.js b/jquery.lazyload.js index 26fab660..f7b1f28e 100644 --- a/jquery.lazyload.js +++ b/jquery.lazyload.js @@ -29,7 +29,8 @@ skip_invisible : false, appear : null, load : null, - placeholder : "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB/AAffA0nNPuCLAAAAAElFTkSuQmCC" + placeholder : "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB/AAffA0nNPuCLAAAAAElFTkSuQmCC", + error : null }; function update() { @@ -127,7 +128,13 @@ settings.load.call(self, elements_left, settings); } }) - .attr("src", $self.attr("data-" + settings.data_attribute)); + .attr("src", $self.attr("data-" + settings.data_attribute)) + .bind("error", function(){ + if (settings.error) { + var elements_left = elements.length; + settings.error.call(self, elements_left, settings); + } + }); } });