-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjavascript.js
106 lines (88 loc) · 2.9 KB
/
javascript.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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
hamburger = document.querySelector(".hamburger");
navMenu = document.querySelector(".nav-menu");
hamburger.addEventListener("click", mobileMenu);
navLink = document.querySelectorAll(".nav-link");
navLink.forEach(n => n.addEventListener("click", closeMenu));
function mobileMenu() {
navMenu.classList.toggle("active");
}
function closeMenu() {
navMenu.classList.remove("active");
}
function changer(abs){
navLink.forEach(n => n.classList.remove("nav-yellow"));
document.getElementById("main").classList.remove("nav-yellow");
document.getElementById("main").classList.add("nav-link");
document.getElementById("one").classList.add("nav-link");
document.getElementById("two").classList.add("nav-link");
document.getElementById(abs).classList.add("nav-yellow");
}
function remover(){
navLink.forEach(n => n.classList.remove("nav-yellow"));
document.getElementById("main").classList.add("nav-yellow");
document.getElementById("one").classList.add("nav-link");
document.getElementById("two").classList.add("nav-link");
}
var one = document.getElementById("one");
var two = document.getElementById("two");
var main = document.getElementById("main");
one.addEventListener("click",scoreb);
two.addEventListener("click",colorp);
main.addEventListener("click",mainer)
function colorp(){
var webp = document.getElementById("webp");
var colo = document.getElementById("colo");
var cric = document.getElementById("cricket");
if(colo.style.display == "none") {
colo.style.display = "block"
webp.style.display = "none"
cric.style.display = "none"
changer("two");
}
else{
colo.style.display = "none"
webp.style.display = "flex"
cric.style.display = "none"
remover();
}
}
function scoreb(){
var colo = document.getElementById("colo");
var webp = document.getElementById("webp");
var cric = document.getElementById("cricket");
if(cric.style.display == "none") {
cric.style.display = "block"
webp.style.display = "none"
colo.style.display = "none"
changer("one");
}
else{
cric.style.display = "none"
webp.style.display = "flex"
colo.style.display = "none"
remover();
}
}
function mainer(){
var webp = document.getElementById("webp");
var colo = document.getElementById("colo");
var cric = document.getElementById("cricket");
colo.style.display = "none";
webp.style.display = "flex";
cric.style.display = "none";
changer("main");
}
window.onscroll = function() {mover()};
var sarpe = document.getElementById("header");
var chipko = sarpe.clientHeight;
function mover(){
var divi = document.getElementById("mains");
if(window.pageYOffset >= chipko){
divi.style.marginTop = String(chipko);
sarpe.classList.add("fix");
}
else{
divi.style.marginTop = "0"
sarpe.classList.remove("fix");
}
}