Last active
December 29, 2015 10:59
-
-
Save RainbowArray/7660902 to your computer and use it in GitHub Desktop.
Modernizr svg/png switching?
This file contains hidden or 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 (!Modernizr.svg) { | |
var svgs = document.querySelectorAll('img[src$=".svg"]'); | |
for (var i = 0, j = svgs.length; i < j; i++) { | |
var src = svgs[i].src.replace('.svg', '.png'); | |
} | |
for (var k = 0, l = svgs.length; k < l; k++) { | |
svgs[k].setAttribute('src', src); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment