fix: move viewport early return above
This commit is contained in:
@@ -47,12 +47,12 @@ let initialCorrectViewportHeight: number | null = null
|
|||||||
export const setViewportHeightWithFallback = (isOrientationChange = false) => {
|
export const setViewportHeightWithFallback = (isOrientationChange = false) => {
|
||||||
const newValue = visualViewport && visualViewport.height > 0 ? visualViewport.height : window.innerHeight
|
const newValue = visualViewport && visualViewport.height > 0 ? visualViewport.height : window.innerHeight
|
||||||
|
|
||||||
if (!newValue) {
|
if (initialCorrectViewportHeight && newValue < initialCorrectViewportHeight && !isOrientationChange) {
|
||||||
document.documentElement.style.setProperty('--viewport-height', '100vh')
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if (initialCorrectViewportHeight && newValue < initialCorrectViewportHeight && !isOrientationChange) {
|
if (!newValue) {
|
||||||
|
document.documentElement.style.setProperty('--viewport-height', '100vh')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user