move footerUpdate function to overlay.ts and combine it with recenter function

This commit is contained in:
Spedon
2023-03-14 01:31:35 +08:00
parent f3d3efb4ff
commit c8e6ab505b
3 changed files with 21 additions and 18 deletions

View File

@@ -61,18 +61,3 @@ export const center = (e: HTMLDivElement): void => {
e.style.top = 'calc((100% - 31px) / 2 + 31px)'
}
}
export function footerHeightUpdateInit(): void {
window.addEventListener(
'resize',
() => {
const r = document.querySelector(':root') as HTMLElement
if (window.innerWidth > 768) {
r.style.setProperty('--footer-height', '38px')
} else {
r.style.setProperty('--footer-height', '31px')
}
},
{ passive: true }
)
}