-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
52 lines (46 loc) · 1.29 KB
/
index.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
function switchDisp(visible) {
let dsp = "none;";
let hdn = "hidden;";
if (visible) {
dsp = "block";
hdn = "visible;";
}
let config = "display: " + dsp + "visibility: " + hdn;
return config;
}
function showNavbar() {
if (typeof showNavbar.openc == "undefined") {
showNavbar.openc = 0;
}
showNavbar.openc++;
showNavbar.openc %= 2;
document.querySelector(".navbar_cross").style.cssText = switchDisp(
showNavbar.openc
);
document.querySelector(".navbar_menu").style.cssText = switchDisp(
!showNavbar.openc
);
document.querySelector(".navbar").style.cssText = switchDisp(
!showNavbar.openc
);
}
function loadContent(containerId, contentFile) {
fetch(contentFile)
.then(response => response.text())
.then(data => {
document.getElementById(containerId).innerHTML = data;
})
.catch(error => console.error("Error loading content: ", error));
}
function loadWebsite() {
const names = {
navbar: "/navbar.html",
footer: "/footer.html",
copyright: "/copyright.html",
};
for (const [div, filename] of Object.entries(names)) {
loadContent(div, filename);
}
let r = document.querySelector(':root').style.setProperty('--navbar-height', '70px');
}
window.onload = loadWebsite();