Skip to content

Instantly share code, notes, and snippets.

@choonkeat
Forked from mislav/zoom.js
Created June 18, 2010 00:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save choonkeat/443003 to your computer and use it in GitHub Desktop.
Save choonkeat/443003 to your computer and use it in GitHub Desktop.
/* tested on the iPad and iPhone */
function getZoomFactor() {
var deviceWidth, landscape = Math.abs(window.orientation) == 90
// workaround for strange screen.height on the iPhone (v3.1.3)
if (window.screen.width == 320) deviceWidth = landscape ? 480 : 320
else deviceWidth = window.screen[landscape ? "height" : "width"]
return deviceWidth / window.innerWidth
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment