Files
2026-06-23 13:28:38 +07:00

15 lines
376 B
JavaScript

// Thanks: https://css-tricks.com/the-trick-to-viewport-units-on-mobile/
export const useDynamicVhCssProperty = () => {
const vh = ref(0)
const updateVh = () => {
vh.value = window.innerHeight * 0.01
document.documentElement.style.setProperty('--vh', `${vh.value}px`)
}
tryOnBeforeMount(() => {
updateVh()
useEventListener('resize', updateVh)
})
}