Skip to content

Instantly share code, notes, and snippets.

@malte-j
Created October 21, 2017 15:58
Show Gist options
  • Save malte-j/f0c122d802f30dd12c0485f10740833f to your computer and use it in GitHub Desktop.
Save malte-j/f0c122d802f30dd12c0485f10740833f to your computer and use it in GitHub Desktop.
Fullscreen elements using js
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