-
Notifications
You must be signed in to change notification settings - Fork 0
/
span.html
104 lines (91 loc) · 2.34 KB
/
span.html
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<style>
body {
margin: 0;
}
.links {
/* margin: 0;
padding: 0; */
/* display: flex;
gap: 10%;
align-items: center;
justify-content: center; */
list-style: none;
width: 0;
overflow: hidden;
transition: all 1s 0s ease-in;
visibility: hidden;
z-index: -10;
background-color: gainsboro;
/* transform: translate(-100%); */
/* height: 0; */
}
.showlink {
width: 100%;
z-index: 10;
visibility: visible;
/* transform: translate(0%); */
}
a {
color: black;
text-decoration: none;
background-color: blue;
/* padding: 10px 20px; */
}
li {
/* height: 0; */
}
header {
background-color: red;
height: 10vh;
/* display: flex;
align-items: center;
justify-content: center;
position: relative; */
}
span {
border: 1px solid blue;
position: absolute;
right: 0;
top: 0;
}
</style>
<body>
<header>
<nav>
<ul class="links">
<li><a href="">services</a></li>
<li><a href="">services</a></li>
<li><a href="">services</a></li>
<li><a href="">services</a></li>
<li><a href="">services</a></li>
<li><a href="">services</a></li>
</ul>
</nav>
<span class="hamburgger">☰</span>
</header>
<script>
// let getEachLink = document.querySelectorAll("a");
// getEachLink.addEventListener("click", () => {
// getEachLink.style.color = "white";
// })
let hamburgger = document.querySelector(".hamburgger");
let ul = document.querySelector(".links");
hamburgger.addEventListener("click", () => {
if (ul.classList.contains("showlink")) {
ul.classList.remove("showlink")
}
else {
ul.classList.add("showlink")
}
})
</script>
</body>
</html>