http://dieulot.net/css-retina-hairline – CSS retina hairline, the easy way – JS
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
if (window.devicePixelRatio && devicePixelRatio >= 2) { | |
var testElem = document.createElement('div'); | |
testElem.style.border = '.5px solid transparent'; | |
document.body.appendChild(testElem); | |
if (testElem.offsetHeight == 1) | |
{ | |
document.querySelector('html').classList.add('hairlines'); | |
} | |
document.body.removeChild(testElem); | |
} | |
// This assumes this script runs in <body>, if it runs in <head> wrap it in $(document).ready(function() { }) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment