revamp template

This commit is contained in:
fro1991
2025-02-01 16:44:51 +07:00
parent c432df568a
commit 276a289580
1212 changed files with 112762 additions and 0 deletions

30
src/utils/Dom.ts Normal file
View File

@ -0,0 +1,30 @@
const getViewPort = (): { width: number; height: number } => {
let e: any = window;
let a: string = 'inner';
if (!('innerWidth' in window)) {
a = 'client';
e = document.documentElement || document.body;
}
return {
width: e[a + 'Width'] as number,
height: e[a + 'Height'] as number
};
};
const getHeight = (element: HTMLElement): number => {
if (!element) return 0;
const styles = window.getComputedStyle(element);
const height = element.getBoundingClientRect().height; // Actual height of the element
const marginTop = parseFloat(styles.marginTop);
const marginBottom = parseFloat(styles.marginBottom);
const totalHeight = height + marginTop + marginBottom;
return totalHeight;
};
export { getHeight, getViewPort };