Skip to content

Instantly share code, notes, and snippets.

@malsup
Forked from mavenlink/refreshBackgrounds.js
Created February 17, 2012 22:28
Show Gist options
  • Save malsup/1855806 to your computer and use it in GitHub Desktop.
Save malsup/1855806 to your computer and use it in GitHub Desktop.
Fix Chrome background refresh bug
// might as well make it a plugin
$.fn.fixChromeBg = function() {
if (! /chrome/i.test(navigator.userAgent) )
return this;
return this.each(function() {
var el = $(this), bi = el.css( 'background-image' );
if (bi) {
setTimeout(function() {
el.css( 'background-image', bi);
}, 1);
}
});
}
@malsup
Copy link
Author

malsup commented Feb 17, 2012

$('.myElementsWithBackgrounds').fixChromeBg();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment