Created
February 12, 2015 00:13
-
-
Save chrisforrette/808bcce870837d21494e to your computer and use it in GitHub Desktop.
Modernizr retina detection
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
Modernizr.addTest('retina', function() { | |
// starts with default value for modern browsers | |
var dpr = window.devicePixelRatio || | |
// fallback for IE | |
(window.screen.deviceXDPI / window.screen.logicalXDPI) || | |
// default value | |
1; | |
return !!(dpr > 1); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment