Skip to content

Instantly share code, notes, and snippets.

@scsskid
Last active October 27, 2020 21:51
Show Gist options
  • Save scsskid/186622ec00331b2db3743eebc89773fb to your computer and use it in GitHub Desktop.
Save scsskid/186622ec00331b2db3743eebc89773fb to your computer and use it in GitHub Desktop.
[ViewPort Height Related Snippets] if -webkit-fill-available isnt enough...
function appHeight() {
document.documentElement.style.setProperty(
'--vh',
window.innerHeight * 0.01 + 'px'
);
}
React.useEffect(() => {
// window.addEventListener('resize', appHeight);
// appHeight();
}, []);
/*
CSS:
height: 100vh;
height: calc(var(--vh, 1vh) * 100);
height: -webkit-fill-available;
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment