Closed paylesworth closed 10 years ago
I just realized that I don't even need the data-src if I am using the srcset extension. Is that the idea?
I did it this way, without the srcset extension:
$.lazyLoadXT.onshow = undefined;
if ('srcset' in (new Image())) {
$.lazyLoadXT.onshow = function () {
var el = $(this);
el.attr('srcset', el.attr('data-srcset'));
};
}
The srcset extension works great but it does not use the data-src attribute. The HTML5 srcset does not require the 1x image in the src to be listed again in the srcset. If I duplicate the URL from data-src in the data-srcset with a 1x after it, all is good but this is redundant.
Maybe after the "return false" if there is no srcset you could append the data-src URL with a 1x. Then it would find that one for 1x screens.