trwnh.com/unified.test.hugo/assets/scripts/main.js
2024-10-05 01:27:07 -05:00

15 lines
No EOL
415 B
JavaScript

/*
Use a window's inner dimensions for viewport units.
This fixes some mobile bugs
*/
var root = document.documentElement;
let vh = window.innerHeight * 0.01;
root.style.setProperty('--vh', `${vh}px`);
// We listen to the resize event
window.addEventListener('resize', () => {
// We execute the same script as before
let vh = window.innerHeight * 0.01;
root.style.setProperty('--vh', `${vh}px`);
});