Skip to content

Instantly share code, notes, and snippets.

@maggo
Created September 30, 2014 09:25
Show Gist options
  • Save maggo/8ac57d5bb9bbc94184b1 to your computer and use it in GitHub Desktop.
Save maggo/8ac57d5bb9bbc94184b1 to your computer and use it in GitHub Desktop.
SVG fallback to png file, based on Modernizr & jQuery
if(typeof Modernizr === "object" && !Modernizr.svg) {
$('img[src$=".svg"]').each(function() {
var $this = $(this),
newSrc = $this.attr('src').replace(/\.svg$/, '.png');
$this.attr('src', newSrc);
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment