Last active
July 23, 2019 11:32
-
-
Save dmssk/ee0267d0618ae695bf9698ea1ecb5873 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
if(navigator.userAgent.match(/iPad/i)) { | |
const ORIGINAL_WIDTH = 1024; | |
const ORIGINAL_HEIGHT = 768; | |
// screen.height === actual device width | |
// screen.width === actual device height | |
const w = screen.height; | |
const h = screen.width; | |
const BROWSER_TABS = h - window.innerHeight; | |
const WIDTH_SCALE = Math.round(w / (ORIGINAL_WIDTH / 100)) / 100; | |
const HEIGHT_SCALE = Math.round((h - BROWSER_TABS) / (ORIGINAL_HEIGHT / 100)) / 100; | |
document.querySelector("body").style.transform = `scale(${WIDTH_SCALE}, ${HEIGHT_SCALE})`; | |
document.querySelector("body").style.transformOrigin = `top left`; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment