Skip to content

Instantly share code, notes, and snippets.

@sam0x17
Last active January 25, 2019 06:28
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sam0x17/52669ac43f7f3e97b06a653213c51181 to your computer and use it in GitHub Desktop.
Save sam0x17/52669ac43f7f3e97b06a653213c51181 to your computer and use it in GitHub Desktop.
True mobile viewport height

mobile browsers these days have annoying address bars / toolbars / etc that interfere with the viewport height, so if you have some 100vh elements they get partially obscured... to get the TRUE height of the viewport use:

Math.min(document.documentElement.clientHeight, window.screen.height, window.innerHeight);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment