Skip to content

Instantly share code, notes, and snippets.

@omniosi
Last active December 20, 2015 04:59
Show Gist options
  • Save omniosi/6075036 to your computer and use it in GitHub Desktop.
Save omniosi/6075036 to your computer and use it in GitHub Desktop.
use modernizr to swap PNGs for SVG files depending on device/browser support
/*SVG CHECK*/
function svgCheck(){
if (!Modernizr.svg) {
$('img.svg').each(function () {
svg = $(this).attr('src');
svg = svg.replace('svg', 'png');
$(this).attr('src', svg);
});
}
}
svgCheck();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment