-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathnavbar.js
160 lines (144 loc) · 5.65 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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
let menu = document.querySelector("#menu").addEventListener("click",submenu)
let count = 0;
function submenu(){
count++
document.querySelector("#menu").src = "https://static.thenounproject.com/png/1707162-200.png"
localStorage.setItem("counter",count)
let counter = localStorage.getItem("counter")
let submenuBar = document.querySelector("#container")
if(counter%2===1&&counter!==0){
submenuBar.style.visibility = "visible"
let Body = document.querySelector("body")
Body.style.backgroundColor = "rgba(0,0,0,0.6)"
}else{
document.querySelector("#menu").src = "https://static.thenounproject.com/png/3025230-200.png"
submenuBar.style.visibility = "hidden"
let Body = document.querySelector("body")
Body.style.backgroundColor = "transparent"
}
// java script for the sub menu bar
let plus = document.querySelector("#first")
plus.addEventListener("click",Plus)
let countPlus = 0;
function Plus(){
countPlus++
let subBar = document.querySelector("#page ul")
if(countPlus%2===1 && countPlus !==0){
subBar.style.position = "relative"
subBar.style.visibility= "visible"
subBar.style.transition = "12s"
document.querySelector("#first").removeAttribute("class")
plus.setAttribute("class","fa-solid fa-minus")
}else{
subBar.style.position = "absolute"
subBar.style.visibility= "hidden"
subBar.style.transition = "0s"
document.querySelector("#first").removeAttribute("class")
plus.setAttribute("class","fa-solid fa-plus")
}
}
// for second plus
let plus2 = document.querySelector("#second")
plus2.addEventListener("click",Plus2)
let countPlus2 = 0;
function Plus2(){
countPlus2++
let subBar2 = document.querySelector("#second-sub-menu")
if(countPlus2%2===1 && countPlus2 !==0){
subBar2.style.position = "relative"
subBar2.style.visibility= "visible"
subBar2.style.transition = "12s"
document.querySelector("#second").removeAttribute("class")
plus2.setAttribute("class","fa-solid fa-minus")
}else{
subBar2.style.position = "absolute"
subBar2.style.visibility= "hidden"
subBar2.style.transition = "0s"
document.querySelector("#second").removeAttribute("class")
plus2.setAttribute("class","fa-solid fa-plus")
}
}
// for third plus
let plus3 = document.querySelector("#three")
plus3.addEventListener("click",Plus3)
let countPlus3 = 0;
function Plus3(){
countPlus3++
let subBar3 = document.querySelector("#three-sub-menu")
if(countPlus3%2===1 && countPlus3 !==0){
subBar3.style.position = "relative"
subBar3.style.visibility= "visible"
subBar3.style.transition = "12s"
document.querySelector("#three").removeAttribute("class")
plus3.setAttribute("class","fa-solid fa-minus")
}else{
subBar3.style.position = "absolute"
subBar3.style.visibility= "hidden"
subBar3.style.transition = "0s"
document.querySelector("#three").removeAttribute("class")
plus3.setAttribute("class","fa-solid fa-plus")
}
}
// for forth plush
let plus4 = document.querySelector("#four")
plus4.addEventListener("click",Plus4)
let countPlus4 = 0;
function Plus4(){
countPlus4++
let subBar4 = document.querySelector("#four-sub-menu")
if(countPlus4%2===1 && countPlus4 !==0){
subBar4.style.position = "relative"
subBar4.style.visibility= "visible"
subBar4.style.transition = "12s"
document.querySelector("#four").removeAttribute("class")
plus4.setAttribute("class","fa-solid fa-minus")
}else{
subBar4.style.position = "absolute"
subBar4.style.visibility= "hidden"
subBar4.style.transition = "0s"
document.querySelector("#four").removeAttribute("class")
plus4.setAttribute("class","fa-solid fa-plus")
}
}
// for five plus
let plus5 = document.querySelector("#five")
plus5.addEventListener("click",Plus5)
let countPlus5 = 0;
function Plus5(){
countPlus5++
let subBar5 = document.querySelector("#five-sub-menu")
if(countPlus5%2===1 && countPlus5 !==0){
subBar5.style.position = "relative"
subBar5.style.visibility= "visible"
subBar5.style.transition = "12s"
document.querySelector("#five").removeAttribute("class")
plus5.setAttribute("class","fa-solid fa-minus")
}else{
subBar5.style.position = "absolute"
subBar5.style.visibility= "hidden"
subBar5.style.transition = "0s"
document.querySelector("#five").removeAttribute("class")
plus5.setAttribute("class","fa-solid fa-plus")
}
}
}
// for serach bar
let search1 = document.querySelector("#Search-logo").addEventListener("click",jkjkjk)
function jkjkjk(){
let searchbar = document.querySelector("#searchbar")
document.querySelector("#Search-logo").style.visibility = "hidden"
searchbar.style.visibility = "visible"
searchbar.style.transition = "0s"
}
let cross = document.querySelector("#cross").addEventListener("click",crossfun)
function crossfun(){
let searchbar = document.querySelector("#searchbar")
document.querySelector("#Search-logo").style.visibility = "visible"
searchbar.style.visibility = "hidden"
searchbar.style.transition = "0s"
}
// cart redirect
document.querySelector("#BagImage").addEventListener("click",function(){
console.log("true")
window.location.href = "cart.html";
})