problem when using javascript to get the actual viewport height

hey folks this is my css
main>div {
  height: 100vh;
  height: calc(var('--vh', 1vh) * 100);
}

and this is my javascript
  window.addEventListener('resize', () => {
    const vh = window.innerHeight * 0.01;

    document.documentElement.style.setProperty('--vh', `${vh}px`);
})

to get the actual viewport height but when I do scrolling I get a janky behaviour
Was this page helpful?