Created
September 30, 2014 09:25
-
-
Save maggo/8ac57d5bb9bbc94184b1 to your computer and use it in GitHub Desktop.
SVG fallback to png file, based on Modernizr & jQuery
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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