Skip to content

Instantly share code, notes, and snippets.

@whitershade
Created June 17, 2016 13:14
Show Gist options
  • Save whitershade/8044d24cb2b92835baac2fdd7b2ba39d to your computer and use it in GitHub Desktop.
Save whitershade/8044d24cb2b92835baac2fdd7b2ba39d to your computer and use it in GitHub Desktop.
JS
let mainHeader = document.getElementById('main-header');
setMainHeaderHeight();
window.onresize = function () {
setMainHeaderHeight();
}
function setMainHeaderHeight() {
let height;
if (typeof document.height !== 'undefined') {
height = document.height // For webkit browsers
} else {
height = document.documentElement.clientHeight;
}
(height > 1200) && (height = 1200);
mainHeader.style.minHeight = `${height}px`;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment