mirror of
https://github.com/SECTL/SecScore.git
synced 2026-07-19 12:34:22 +08:00
修复 iOS 底部黑边,改为动态同步视口高度
This commit is contained in:
@@ -77,6 +77,23 @@ const patchConsole = () => {
|
||||
}
|
||||
patchConsole()
|
||||
|
||||
const syncAppViewportHeight = () => {
|
||||
const rootStyle = document.documentElement.style
|
||||
|
||||
const applyHeight = () => {
|
||||
const viewportHeight = window.visualViewport?.height ?? window.innerHeight
|
||||
rootStyle.setProperty("--ss-app-height", `${Math.round(viewportHeight)}px`)
|
||||
}
|
||||
|
||||
applyHeight()
|
||||
window.addEventListener("resize", applyHeight)
|
||||
window.addEventListener("orientationchange", applyHeight)
|
||||
window.visualViewport?.addEventListener("resize", applyHeight)
|
||||
window.visualViewport?.addEventListener("scroll", applyHeight)
|
||||
}
|
||||
|
||||
syncAppViewportHeight()
|
||||
|
||||
const disableTouchZoom = () => {
|
||||
let lastTouchEnd = 0
|
||||
|
||||
|
||||
Reference in New Issue
Block a user