-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnavbar.js
79 lines (62 loc) · 1.85 KB
/
navbar.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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
var scrollableElement = document; //document.getElementById('scrollableElement');
scrollableElement.addEventListener("scroll", checkScrollDirection);
let scrollValueTop = 1;
let scrollValueBottom = 1;
let previous = -Infinity;
function checkScrollDirection(event) {
if (scrollValueTop == 1) {
let nav = document.querySelector("#navbar");
nav.setAttribute("class", "");
}
if (window.pageYOffset < 2) {
let nav = document.querySelector("#navbar");
nav.setAttribute("class", "");
}
scrollValueTop = window.pageYOffset;
if (previous < scrollValueTop) {
let nav = document.querySelector("#navbar");
nav.setAttribute("class", "");
previous = scrollValueTop;
} else {
if (window.pageYOffset > 2) {
let nav = document.querySelector("#navbar");
nav.setAttribute("class", "stickyNav");
previous--;
}
}
}
// menubar
var modal = document.getElementById("myModal");
var btn = document.getElementById("myBtn");
var span = document.getElementsByClassName("close")[0];
btn.onclick = function() {
modal.style.display = "block";
document.body.style.overflow="hidden";
}
span.onclick = function() {
modal.style.display = "none";
document.body.style.overflowY="scroll";
}
//////////////////////
// Events
document.querySelector("#logo").addEventListener("click", () => {
window.location.href = "homePage.html";
});
let abt=document.querySelectorAll(".aboutPage");
abt.forEach(function(ele){
ele.addEventListener("click", () => {
window.location.href = "about.html";
});
})
let log=document.querySelectorAll(".login");
log.forEach(function(ele){
ele.addEventListener("click", () => {
window.location.href = "login.html";
});
})
let buttons = document.querySelectorAll(".signup");
buttons.forEach(function (ele) {
ele.addEventListener("click", () => {
window.location.href = "signup.html";
});
});