Created
May 5, 2014 17:22
-
-
Save elioverbey/03a46d256add1556b583 to your computer and use it in GitHub Desktop.
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
// Check if browser can handle SVG | |
if(!Modernizr.svg){ | |
// Get all img tag of the document and create variables | |
var i=document.getElementsByTagName("img"),j,y; | |
// For each img tag | |
for(j = i.length ; j-- ; ){ | |
y = i[j].src | |
// If filenames ends with SVG | |
if( y.match(/svg$/) ){ | |
// Replace "svg" by "png" | |
i[j].src = y.slice(0,-3) + 'png' | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment