1
0
Fork 0
mirror of https://github.com/muerwre/vault-frontend.git synced 2025-04-28 22:26:41 +07:00
vault-frontend/src/hooks/dom/useScrollHeight.ts
2022-01-11 11:31:42 +07:00

17 lines
349 B
TypeScript

const getHeight = () => {
if (typeof document === 'undefined') {
return 0;
}
const body = document.body;
const html = document.documentElement;
return Math.max(
body.scrollHeight,
body.offsetHeight,
html.clientHeight,
html.scrollHeight,
html.offsetHeight
);
};
export const useScrollHeight = () => getHeight();