Quick post to remove the annoyance that is this bug from my short term memory, you would think this would work:
var newBGString = $(this).css('background-image');
…it does, but not in firefox. Say the background property was set to “url(someimage.png) top left no-repeat”, making the background-image property “url(someimage.png)” right? In every browser except firefox, yes, not for firefox. Firefox would set the var as “url(“someimage.png”)” and THEN complain that the var is not realistic when you go on to use it elsewhere.
Anyway ridiculous bug, almost as annoying is how simple, hacky and rough the fix is:
var newBGString = $(this).css('background-image').replace('"','');
So if your firefox doesn’t like background image swapping via js, try it, I guess…
Comments Archive
Hi there. This is my old blog and it's archived, so you can no longer post new comments on this post (Firefox, why you mutate my css?).
Read my new blog about writing software and stories at WoodyHayday.com