-
Notifications
You must be signed in to change notification settings - Fork 0
/
layout.js
37 lines (36 loc) · 1.11 KB
/
layout.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/*
Fn gets called in app.js with (".header", "--height-header"), (".intro__highlight", "--height-highlights") and (".skill__heading__nav", "--height-menu")
*/
export function processElementHeight(targetSelector, propertyName) {
const target = document.querySelector(`${targetSelector}`);
if (target) {
let heightTarget = target.offsetHeight;
document.documentElement.style.setProperty(
`${propertyName}`,
`${heightTarget}px`
);
window.addEventListener("resize", () => {
heightTarget = target.offsetHeight;
document.documentElement.style.setProperty(
`${propertyName}`,
`${heightTarget}px`
);
});
}
}
export function setHeaderMenuItems() {
const currentPathname = window.location.pathname;
const itemHome = document.querySelector("#js-menu-home-item");
const itemServices = document.querySelector("#js-menu-services-item");
switch (currentPathname) {
case "/":
itemHome.style.display = "none";
break;
case "/profile":
case "/profile.html":
itemServices.style.display = "none";
break;
default:
break;
}
}