Created
January 17, 2014 20:56
-
-
Save 3rd-Eden/8481349 to your computer and use it in GitHub Desktop.
Fixing chrome's font-rendering issues.
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
(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