Last active
February 13, 2018 02:57
-
-
Save WunGCQ/85574c56e289fdd09cca68199fcf4ec2 to your computer and use it in GitHub Desktop.
calculate 100vh to window.innerHeight to prevent keyboard squeeze window height on mobile
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
export function resetVH(){ | |
const vh100 = window.innerHeight; | |
const styleContent = ` | |
.vh-100 { | |
height: ${vh100}px; | |
} | |
`; | |
const node = document.createElement('style'); | |
node.type = 'text/css'; | |
node.innerHTML = styleContent; | |
document.head.appendChild(node); | |
console.log(node); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment