-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
46 lines (38 loc) · 976 Bytes
/
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
let myArray = [];
function myFunc(element){
element.style.backgroundColor = "#FF0000";
myArray.push(element);
console.log(myArray);
}
function resetColor(element){
element.style.backgroundColor = "#00008B";
}
function myFuncReset(element){
element.style.backgroundColor = "#FF0000";
myArray.push(element);
console.log(myArray);
for(var i = 0; i < myArray.length; i++){
(function(i){
setTimeout(function(){
myArray[i].style.backgroundColor = "#00008B";
}, 200 * (i + 1));
})(i);
}
}
burger = document.querySelector('.burger');
navbar = document.querySelector('.navbar');
nav = document.querySelector('.nav');
ham = document.querySelector('#ham');
let state=0;
ham.addEventListener('click',()=>{
navbar.classList.toggle('h-nav');
nav.classList.toggle('v-class');
if(state==0){
ham.src = "logos/hamburger-cross.png";
state=1;
}
else{
ham.src = "logos/hamburger.png";
state=0;
}
})