Last active
December 20, 2015 04:59
-
-
Save omniosi/6075036 to your computer and use it in GitHub Desktop.
use modernizr to swap PNGs for SVG files depending on device/browser support
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
/*SVG CHECK*/ | |
function svgCheck(){ | |
if (!Modernizr.svg) { | |
$('img.svg').each(function () { | |
svg = $(this).attr('src'); | |
svg = svg.replace('svg', 'png'); | |
$(this).attr('src', svg); | |
}); | |
} | |
} | |
svgCheck(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment