-
Notifications
You must be signed in to change notification settings - Fork 1
/
burger.html
66 lines (54 loc) · 1.46 KB
/
burger.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
<html>
<head>
<title>Burger Menu Test</title>
<link rel="stylesheet" href="burger_css.css">
</head>
<body>
<div class="content second">
<h1>Cross with animation menu</h1>
<div class="burger">
<span></span>
</div>
</div>
<div id="overlay" class="hidden">
<a href="#"><h1>Test</h1></a>
<a href="#"><h1>Test2</h1></a>
</div>
</body>
<style>
#overlay {
display: block;
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 255, 0.7); /* Blue background with transparency */
color: white;
font-size: 2em;
text-align: center;
padding-top: 20%;
opacity: 1;
transition: opacity 0.5s ease; /* Add a transition for the opacity property */
/*z-index: 9999; /* Ensure it appears on top of everything */
}
#overlay.hidden {
opacity: 0; /* When the "hidden" class is added, fade out the overlay */
pointer-events: none; /* Make sure the hidden overlay is not clickable */
}
</style>
<script>
let pressed = false;
const burger = document.querySelector('.burger');
burger.addEventListener('click', () => {
burger.classList.toggle('active');
if (pressed == false) {
document.getElementById('overlay').classList.remove('hidden');
pressed = true;
} else {
document.getElementById('overlay').classList.add('hidden');
pressed = false;
}
});
</script>
</html>