fix scroll value and record viewport when loaded
This commit is contained in:
16
src/utils.ts
16
src/utils.ts
@@ -79,3 +79,19 @@ export function hookSetter<T>(
|
||||
});
|
||||
return () => hookSetter(target, key, original || {});
|
||||
}
|
||||
|
||||
export function getWindowHeight(): number {
|
||||
return (
|
||||
window.innerHeight ||
|
||||
(document.documentElement && document.documentElement.clientHeight) ||
|
||||
(document.body && document.body.clientHeight)
|
||||
);
|
||||
}
|
||||
|
||||
export function getWindowWidth(): number {
|
||||
return (
|
||||
window.innerWidth ||
|
||||
(document.documentElement && document.documentElement.clientWidth) ||
|
||||
(document.body && document.body.clientWidth)
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user