Skip to content

Instantly share code, notes, and snippets.

@WunGCQ
Last active February 13, 2018 02:57
Show Gist options
  • Save WunGCQ/85574c56e289fdd09cca68199fcf4ec2 to your computer and use it in GitHub Desktop.
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
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