Created
October 21, 2017 15:58
-
-
Save malte-j/f0c122d802f30dd12c0485f10740833f to your computer and use it in GitHub Desktop.
Fullscreen elements using js
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
function calcVH () { | |
var vH = Math.max(document.documentElement.clientHeight, window.innerHeight || 0); | |
document.querySelector('body').setAttribute("style", "height:" + vH + "px;"); | |
} | |
window.onload = calcVH(); | |
window.addEventListener('onorientationchange', calcVH, true); | |
window.addEventListener('resize', calcVH, true); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment