Created
June 23, 2012 17:57
-
-
Save owainlewis/2979230 to your computer and use it in GitHub Desktop.
Firefox background image rendering bug, jQuery
This file contains 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
/* | |
* I encountered a strange bug with Firefox and dynamic background image updates. | |
* Background images can't be dynamically updated either through the console or via JavaScript. | |
* A simple hack is to update the opacity by a very small increment. | |
* This will force Firefox to re-render the background image correctly. | |
*/ | |
var rand_opacity = ((0.9 + Math.floor((Math.random()*10)+1))/100); | |
$(el).css({"background-image":new_image, 'opacity':0.9 + rand_opacity}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment