-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmyscript.js
More file actions
41 lines (36 loc) · 1.14 KB
/
myscript.js
File metadata and controls
41 lines (36 loc) · 1.14 KB
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
const mediaQuery = window.matchMedia("(max-width: 425px)");
let hamburger = document.getElementById("dropKey");
let container = document.getElementById("wrapper");
let listView = document.getElementById("listCan");
let headChange = document.getElementById("header");
let cancel = hamburger;
container.classList.remove("control");
function checkMediaQuery() {
if (mediaQuery.matches) {
dropKey();
}
}
function dropKey() {
container.classList.add("control");
listView.style.display = "block";
listView.style.display = "flex";
listView.classList.add("listContainer");
headChange.classList.add("space");
cancel.src = "Assets/images/icons8_Close_5.svg";
cancel.classList.add("close");
}
function reverseKey() {
listView.style.display = "none";
cancel.classList.remove("close");
container.classList.remove("control");
headChange.classList.remove("space");
cancel.src = 'Assets/images/menu-hamburger-svgrepo-com.svg'
}
cancel.addEventListener('click', () => {
if (!container.classList.contains("control")) {
checkMediaQuery();
} else {
reverseKey();
}
})
mediaQuery.addEventListener;