-
Notifications
You must be signed in to change notification settings - Fork 0
/
header.html
182 lines (167 loc) · 4.93 KB
/
header.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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
<header>
<nav class="topnav">
<div class="dropdown" data-dropdown>
<a href="/index.html" class="link">Home</a>
</div>
<div class="dropdown" data-dropdown>
<button class="link" data-dropdown-button>Zadaci</button>
<div class="dropdown-menu dropdown-links">
<a href="/zadaci/zadatak13.html" class="link">Hrvatska vs Argentina</a>
<a href="/zadaci/validacija.html" class="link">Validacija</a>
<a href="/zadaci/chess.html" class="link">Šah</a>
</div>
</div>
<div class="dropdown" data-dropdown>
<button class="link" data-dropdown-button>About</button>
<div class="dropdown-menu information-grid">
<div>
<div class="dropdown-heading">Project</div>
<div class="dropdown-links">
<a href="#" class="link">Status</a>
<a href="#" class="link">Development</a>
<a href="#" class="link">Text Animation</a>
<a href="#" class="link">Report a bug</a>
</div>
</div>
<div>
<div class="dropdown-heading">Team</div>
<div class="dropdown-links">
<a href="#" class="link">Members</a>
<a href="#" class="link">Roles</a>
<a href="#" class="link">Open positions</a>
</div>
</div>
<div>
<div class="dropdown-heading">Documentation</div>
<div class="dropdown-links">
<a href="#" class="link">User manual</a>
<a href="#" class="link">Developer manual</a>
<a href="#" class="link">API documentation</a>
</div>
</div>
<div>
<div class="dropdown-heading">History</div>
<div class="dropdown-links">
<a href="#" class="link">Fouding</a>
<a href="#" class="link">Early development</a>
<a href="#" class="link">Timeline</a>
</div>
</div>
</div>
</div>
<div class="dropdown" data-dropdown>
<button class="link" data-dropdown-button>News</button>
<div class="dropdown-menu">
<div class="dropdown-links">
<a href="#" class="link">Version 1.3rc1 testing</a>
<a href="#" class="link">Version 1.2 release</a>
</div>
</div>
</div>
<div class="dropdown" data-dropdown>
<button class="link" data-dropdown-button>Login</button>
<div class="dropdown-menu">
<form class="login-form">
<label for="email">Email</label>
<input type="email" name="email" id="email" />
<label for="password">Password</label>
<input type="password" name="password" id="password" />
<button type="submit">Login</button>
</form>
</div>
</div>
</nav>
</header>
<style>
header {
width: 100%;
display: flex;
flex-direction: row;
justify-content: space-evenly;
position: sticky;
font-size: 1.5rem;
padding: 0.75rem;
background: rgba(0, 0, 0, 0.6);
color: white;
}
@supports (-webkit-backdrop-filter: none) or (backdrop-filter: none) {
header {
-webkit-backdrop-filter: blur(10px);
backdrop-filter: blur(10px);
}
}
.topnav {
display: flex;
flex-direction: row;
justify-content: space-evenly;
gap: 10rem;
}
.link {
background: none;
border: none;
color: rgb(174, 174, 174);
text-decoration: none;
font-family: inherit;
font-size: inherit;
cursor: pointer;
padding: 0;
mix-blend-mode: difference;
white-space: nowrap;
}
.dropdown {
position: relative;
}
.dropdown.active>.link:focus,
.link:hover {
color: white;
}
.dropdown-menu {
position: absolute;
left: 0;
top: calc(100% + 0.25rem);
background-color: rgba(0, 0, 0, 0.8);
width: fit-content;
padding: 0.75rem;
border-radius: 0.25rem;
box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.1);
opacity: 0;
pointer-events: none;
transition: opacity 150ms ease-in-out, transform 150ms;
transform: translateY(-15px);
font-size: 1.25rem;
}
.dropdown.active>.link+.dropdown-menu {
opacity: 1;
transform: translateY(0);
pointer-events: auto;
}
.information-grid {
display: grid;
grid-template-columns: repeat(2, max-content);
gap: 2rem;
}
.dropdown-links {
display: flex;
flex-direction: column;
gap: 0.25rem;
}
.login-form>input {
margin: 0.5rem;
}
</style>
<script>
document.addEventListener("click", (e) => {
const isDropdownButton = e.target.matches("[data-dropdown-button]");
if (!isDropdownButton && e.target.closest("[data-dropdown]") != null)
return;
let currentDropdown;
if (isDropdownButton) {
currentDropdown = e.target.closest("[data-dropdown]");
currentDropdown.classList.toggle("active");
}
document.querySelectorAll("[data-dropdown].active").forEach((dropdown) => {
if (dropdown == currentDropdown) return;
dropdown.classList.remove("active");
});
});
</script>