mirror of
https://github.com/trwnh/hugo-theme-paradox.git
synced 2024-11-14 23:41:20 +00:00
15 lines
398 B
JavaScript
15 lines
398 B
JavaScript
|
/*
|
||
|
Use a window's inner dimensions for viewport units.
|
||
|
This fixes
|
||
|
*/
|
||
|
|
||
|
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`);
|
||
|
});
|