ressio / lazy-load-xt

Lazy load XT is a jQuery plugin for images, videos and other media
http://ress.io/lazy-load-xt-jquery/
MIT License
1.36k stars 245 forks source link

No support for SVG #7

Closed ghost closed 10 years ago

ghost commented 10 years ago

There doesn't appear to be any support for SVGs, is this planned at all? Currently, if you use an SVG, it isn't loaded in by the browser at all (but it does without lazy-loading enabled). It'd be great if you could incorporate some sort of SVG support with fall-back to PNG, like this javascript plugin: https://github.com/benhowdle89/svgeezy

dryabov commented 10 years ago

SVG images embedded using <img> tag are supported: http://jsfiddle.net/9bd6n/ Could you create test case somewhere (e.g. on jsfiddle.net)?

ghost commented 10 years ago

Thanks for the speedy reply, I'll test for other possible causes and get back

ghost commented 10 years ago

Apologies for this... svg is now working, was a mistake whereby "src" was used instead of "data-src". Do you support fall-back to PNG for when the browser doesn't render SVG, is there any way to specify this / any compatible add-ons similar to srcset for example? If not, might be able to combine with a third party script using the $.lazyLoadXT.onload event.

dryabov commented 10 years ago

There is no fallback to png, but it can be done either by processing loading error in lazyerror event, or by creating srcAttr function to handle browsers without SVG support.

ghost commented 10 years ago

Thanks for the tip, I'll give this a go