Skip to content

Instantly share code, notes, and snippets.

@kaseybon
Created November 6, 2017 19:09
Show Gist options
  • Save kaseybon/57d6b9f1c52930af931ea9a655e9661e to your computer and use it in GitHub Desktop.
Save kaseybon/57d6b9f1c52930af931ea9a655e9661e to your computer and use it in GitHub Desktop.
Uses modernizr to swap the file extension of an svg image if svg is not supported.
if(!Modernizr.svg) {
$('img[src*="svg"]').attr('src', function() {
return $(this).attr('src').replace('.svg', '.png');
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment