Skip to content

Instantly share code, notes, and snippets.

@3rd-Eden
Created January 17, 2014 20:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 3rd-Eden/8481349 to your computer and use it in GitHub Desktop.
Save 3rd-Eden/8481349 to your computer and use it in GitHub Desktop.
Fixing chrome's font-rendering issues.
(function () {
//
// Set name of the visibility change event.
//
var visibilityChange, hidden;
if (typeof document.hidden !== 'undefined') {
hidden = 'hidden';
visibilityChange = 'visibilitchange';
} else if (typeof document.webkitHidden !== 'undefined') {
hidden = 'webkitHidden';
visibilityChange = 'webkitvisibilitychange';
}
//
// Not supported, or not specifically targeting chrome.
//
if (!visibilityChange || 'undefined' === typeof document.addEventListener) return;
document.addEventListener(visibilityChange, function changed() {
//
// Force a redraw of the page by scrolling to the same position.
//
if (!document[hidden]) {
window.scrollTo(window.scrollX, window.scrollY);
}
}, false);
}());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment