Skip to content

Instantly share code, notes, and snippets.

@th3hunt
Last active January 28, 2016 12:38
Show Gist options
  • Save th3hunt/4b7b40978adee223598f to your computer and use it in GitHub Desktop.
Save th3hunt/4b7b40978adee223598f to your computer and use it in GitHub Desktop.
Retina checking function
export default function onRetina() {
if (window.matchMedia) {
var mq = window.matchMedia('only screen and (-webkit-min-device-pixel-ratio: 2),' +
'only screen and ( min--moz-device-pixel-ratio: 2),' +
'only screen and ( -o-min-device-pixel-ratio: 2/1),' +
'only screen and ( min-device-pixel-ratio: 2),' +
'only screen and ( min-resolution: 192dpi),' +
'only screen and ( min-resolution: 2dppx)');
return mq ? mq.matches : false
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment