Created
August 6, 2016 20:12
-
-
Save glmdev/c54feef82b3ccfc1bae570123fe21565 to your computer and use it in GitHub Desktop.
Simple function to check if the client has retina support.
This file contains hidden or 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 __isRetinaDisplay() { | |
if (window.matchMedia) { | |
var mq = window.matchMedia("only screen and (min--moz-device-pixel-ratio: 1.3), only screen and (-o-min-device-pixel-ratio: 2.6/2), only screen and (-webkit-min-device-pixel-ratio: 1.3), only screen and (min-device-pixel-ratio: 1.3), only screen and (min-resolution: 1.3dppx)"); | |
return (mq && mq.matches || (window.devicePixelRatio > 1)); | |
} | |
} | |
window.isRetina = __isRetinaDisplay(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment