hugo-theme-paradox/assets/scripts/main.js

15 lines
415 B
JavaScript
Raw Normal View History

2022-10-11 09:54:07 +00:00
/*
Use a window's inner dimensions for viewport units.
2022-10-11 10:26:24 +00:00
This fixes some mobile bugs
2022-10-11 09:54:07 +00:00
*/
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`);
});