Created
December 31, 2012 12:38
-
-
Save msreddy09/4419471 to your computer and use it in GitHub Desktop.
I am not getting correct device pixel ratio in FF of mobile devices
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 ratio = window.devicePixelRatio || | |
(function(i){ | |
var wmq = window.matchMedia; | |
while( !window.devicePixelRatio && i > 0 && | |
!wmq("(min--moz-device-pixel-ratio:" + i/10 + ")").matches ){ | |
i=i-1; | |
} | |
return i/10; | |
})(30); | |
I used the above code to getting the result, But it fails in Firefox browser. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
var ratio = window.devicePixelRatio ||
(function(i){
var wmq = window.matchMedia;
while( !window.devicePixelRatio && i > 0 &&
!wmq("(min--moz-device-pixel-ratio:" + i/10 + ")").matches ){
i=i-1;
}
return i/10;
})(30);
I used the above code to getting the result, But it fails in Firefox browser.