Skip to content

Instantly share code, notes, and snippets.

@iamkevingreen
Created June 10, 2013 16:13
Show Gist options
  • Save iamkevingreen/5750018 to your computer and use it in GitHub Desktop.
Save iamkevingreen/5750018 to your computer and use it in GitHub Desktop.
PNG fallback for SVG background images
var svgSupport = (window.SVGSVGElement) ? true : false;
if (svgSupport == false || $.browser.msie == true) {
$('.svg').each(function(){
var svgBI = $(this).css('background-image');
if (svgBI.indexOf("svg") > -1){
pngBI = svgBI.replace('svg', 'png');
$(this).css('background-image',pngBI);
};
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment