more robust png fallback

This commit is contained in:
Robin Appelman 2012-02-26 03:10:01 +01:00
parent 797e921b9a
commit a5e892505e
1 changed files with 12 additions and 6 deletions

View File

@ -252,16 +252,22 @@ function replaceSVG(){
$('.svg').each(function(index,element){
element=$(element);
var background=element.css('background-image');
if(background && background!='none'){
background=background.substr(0,background.length-4)+'png)';
element.css('background-image',background);
if(background){
var i=background.lastIndexOf('.svg');
if(i>=0){
background=background.substr(0,i)+'.png'+background.substr(i+4);
element.css('background-image',background);
}
}
element.find('*').each(function(index,element) {
element=$(element);
var background=element.css('background-image');
if(background && background!='none'){
background=background.substr(0,background.length-4)+'png)';
element.css('background-image',background);
if(background){
var i=background.lastIndexOf('.svg');
if(i>=0){
background=background.substr(0,i)+'.png'+background.substr(i+4);
element.css('background-image',background);
}
}
});
});