abdullahtarawneh.com/static/scripts/mobileViewportHeight.js
2021-12-22 17:40:37 -06:00

19 lines
536 B
JavaScript

var root = document.documentElement;
let vh = window.innerHeight * 0.01;
root.style.setProperty('--vh', `${vh}px`);
this.lastHeight = window.innerHeight;
/*
// We listen to the resize event
window.addEventListener('resize', () => {
// We execute the same script as before
if (
window.innerWidth > window.innerHeight ||
Math.abs(this.lastHeight - window.innerHeight) > 100
) {
let vh = window.innerHeight * 0.01;
root.style.setProperty('--vh', `${vh}px`);
this.lastHeight = window.innerHeight;
}
});
*/