-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsecondIndex.html
90 lines (76 loc) · 1.85 KB
/
secondIndex.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
<!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>
.menu-icon {
display: block;
width: 30px;
height: 30px;
position: absolute;
cursor: pointer;
}
.menu-line {
width: 100%;
height: 3px;
background-color: #000;
position: absolute;
top: 50%;
transform: translateY(-50%);
transition: all 0.3s ease;
}
.menu-line:nth-child(1) {
top: 10%;
}
.menu-line:nth-child(2) {
top: 50%;
}
.menu-line:nth-child(3) {
top: 90%;
}
.menu.open .menu-line:nth-child(1) {
transform: rotate(45deg) translate(5px, 5px);
}
.menu.open .menu-line:nth-child(2) {
opacity: 0;
}
.menu.open .menu-line:nth-child(3) {
transform: rotate(-45deg) translate(5px, -5px);
}
.menu {
display: none;
position: absolute;
top: 0;
right: 0;
background-color: #fff;
padding: 20px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
}
.menu.open {
display: block;
}
</style>
<div class="menu-icon">
<div class="menu-line"></div>
<div class="menu-line"></div>
<div class="menu-line"></div>
</div>
<div class="menu">
<ul>
<li><a href="#">Menü öğesi 1</a></li>
<li><a href="#">Menü öğesi 2</a></li>
<li><a href="#">Menü öğesi 3</a></li>
</ul>
</div>
<script>
const menuIcon = document.querySelector('.menu-icon');
const menu = document.querySelector('.menu');
menuIcon.addEventListener('click', function() {
menuIcon.classList.toggle('open');
menu.classList.toggle('open');
});
</script>