Created
September 10, 2013 07:06
-
-
Save leohxj/6505936 to your computer and use it in GitHub Desktop.
判断是否是高清屏设备
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
var isRetina = function(){ | |
var mediaQuery = "(-webkit-min-device-pixel-ratio: 1.5),\ | |
(min--moz-device-pixel-ratio: 1.5),\ | |
(-o-min-device-pixel-ratio: 3/2),\ | |
(min-resolution: 1.5dppx)"; | |
if (window.devicePixelRatio > 1) | |
return true; | |
if (window.matchMedia && window.matchMedia(mediaQuery).matches) | |
return true; | |
return false; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment