I am using blazy image loader and I am trying to get the data src from the element on error. Basically if the image is not found or invalid I want to change the last 4 letters of the image src, but I cannot figure out how to get the actual source. Here is my code:
var bLazy = new Blazy({
loadInvisible: true,
error: function (ele, msg) {
if (msg === 'missing') {
var dsrc = ele.src();
var fallback = dsrc.replace('y.jpg','b.jpg');
ele.src(fallback);
} else if (msg === 'invalid') {
console.log(this);
}
},
success: function(ele,msg){
//console.log(ele.parseJSON());
console.log(this);
}
});
I also tried ele.attr('data-src');
and that didn't work either. When I look at the console for console.log(ele) I get the actual image not the element.
Anyone who could help... please!!