-
Notifications
You must be signed in to change notification settings - Fork 0
/
ntti.js
61 lines (55 loc) · 1.97 KB
/
ntti.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
53
54
55
56
57
58
59
60
61
window.onbeforeunload = function () {
window.scrollTo(0, 0);
};
const navbar1 = document.querySelector(".navigation1");
const navbar2 = document.querySelector(".navigation2");
const navMobile = document.querySelector(".mobile-wrapper");
navbar1.insertAdjacentHTML("afterend", '<div class="affix" id="affix"></div>');
const affix = document.querySelector(".affix");
affix.appendChild(navbar2.cloneNode(false));
const element = document.getElementById("affix");
if (element !== null) {
const position = navbar1.getBoundingClientRect().top + window.pageYOffset;
window.addEventListener("scroll", function () {
const height = window.pageYOffset;
if (height > position) {
navbar1.style.display = "none";
navbar2.style.position = "fixed";
navbar2.style.top = "0";
navbar2.style.marginTop = "0";
navbar2.style.marginLeft = "10px";
navbar2.style.boxShadow = " 0px 2px 12px rgb(0 0 0 /0.1)";
navbar2.style.width = "100%";
navMobile.style.position = "fixed";
navMobile.style.top = "0";
navMobile.style.marginTop = "0";
navMobile.style.boxShadow = " 0px 2px 12px rgb(0 0 0 /0.1)";
navMobile.style.width = "100%";
affix.style.display = "flex";
} else {
navbar1.style.display = "flex";
navbar2.style.position = "fixed";
navbar2.style.marginTop = "50px";
navbar2.style.boxShadow = " 0px 0px 0px rgb(0 0 0 /0.0)";
navMobile.style.position = "fixed";
navMobile.style.marginTop = "80px";
navMobile.style.boxShadow = " 0px 0px 0px rgb(0 0 0 /0.0)";
affix.style.display = "none";
}
});
}
function menuOpen() {
document.getElementById("navigation-mobile").classList.toggle("visible");
}
function About() {
document.getElementById("about-mobile").classList.toggle("show");
}
function Department() {
document.getElementById("dept-mobile").classList.toggle("show");
}
function Management() {
document.getElementById("management-mobile").classList.toggle("show");
}
function Link() {
document.getElementById("link-mobile").classList.toggle("show");
}