Add initial project files

This commit is contained in:
Igor Martyniuk
2026-09-01 13:03:41 +03:00
parent 22e111bb44
commit 74cb5b6176
1841 changed files with 242819 additions and 30 deletions
+11
View File
@@ -0,0 +1,11 @@
# [←](../../Readme.md) Огляд DOM утиліт
### # getHeight(element: HTMLElement): number
Повертає повну висоту елемента в пікселях, включаючи `margin-top` та `margin-bottom`.
Якщо елемент не передано — повертає `0`.
```ts
getHeight(document.querySelector('.my-element')); // → 124 (height + margins)
```
+13
View File
@@ -0,0 +1,13 @@
export function getHeight(element: HTMLElement): number {
if (!element) return 0;
const styles = window.getComputedStyle(element);
const height = element.getBoundingClientRect().height;
const marginTop = parseFloat(styles.marginTop);
const marginBottom = parseFloat(styles.marginBottom);
const totalHeight = height + marginTop + marginBottom;
return totalHeight;
}
+1
View File
@@ -0,0 +1 @@
export * from './getHeight';