edtorba/imlazy.js

Add retina support

edtorba opened this issue · 1 comments

Add retina support

Code for detecting high density display:

// Source: http://stackoverflow.com/a/19690464
function isHighDensity() {
  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)); 
  }
}