Skip to content

Commit 4795afb

Browse files
committed
Add mobile dropdown menu (for screens < 500px)
1 parent 6b41ac3 commit 4795afb

2 files changed

Lines changed: 597 additions & 553 deletions

File tree

feascript-website.css

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,104 @@ footer {
137137
border-top: 2px solid #e0c97f;
138138
}
139139

140+
#hamburger {
141+
display: none;
142+
position: absolute;
143+
top: 0px;
144+
right: 0px;
145+
background: none;
146+
border: none;
147+
cursor: pointer;
148+
padding: 10px;
149+
}
150+
151+
#hamburger span {
152+
display: block;
153+
width: 20px;
154+
height: 2.5px;
155+
background-color: #555;
156+
margin: 2px 0;
157+
transition: 0.3s;
158+
}
159+
160+
#mobile-menu {
161+
display: none;
162+
position: absolute;
163+
top: 100%;
164+
right: 0px;
165+
background: white;
166+
border: 1px solid #ddd;
167+
border-radius: 4px;
168+
box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
169+
z-index: 1000;
170+
min-width: 200px;
171+
}
172+
173+
#mobile-menu ul {
174+
list-style: none;
175+
margin: 0;
176+
padding: 0;
177+
}
178+
179+
#mobile-menu li {
180+
padding: 6px 10px;
181+
border-bottom: 1px solid #eee;
182+
}
183+
184+
#mobile-menu li:last-child {
185+
border-bottom: none;
186+
}
187+
188+
#mobile-menu li a {
189+
color: #555;
190+
text-decoration: none;
191+
font-weight: bold;
192+
font-size: 14px;
193+
}
194+
195+
#mobile-menu li a:hover {
196+
color: #333;
197+
}
198+
199+
#mobile-menu.open {
200+
display: block;
201+
top: calc(100% + 6px);
202+
right: 0px;
203+
min-width: 100px;
204+
animation: mobileMenuFadeIn 160ms ease;
205+
}
206+
207+
/* small fade-in */
208+
@keyframes mobileMenuFadeIn {
209+
from {
210+
opacity: 0;
211+
transform: translateY(-6px);
212+
}
213+
214+
to {
215+
opacity: 1;
216+
transform: translateY(0);
217+
}
218+
}
219+
220+
/* Show hamburger only on small screens */
221+
@media screen and (max-width: 500px) {
222+
#hamburger {
223+
display: block;
224+
}
225+
226+
#menu {
227+
display: none;
228+
}
229+
}
230+
231+
/* On wider screens hide the hamburger */
232+
@media screen and (min-width: 500px) {
233+
#hamburger {
234+
display: none !important;
235+
}
236+
}
237+
140238
/*
141239
════════════════════════════════════════════════════════════
142240
CONTENT ELEMENTS
@@ -366,6 +464,10 @@ mjx-container {
366464
height: 40px;
367465
}
368466

467+
#menu {
468+
display: none;
469+
}
470+
369471
.highlight-container,
370472
li {
371473
max-width: 400px;
@@ -407,6 +509,10 @@ mjx-container {
407509
height: 60px;
408510
}
409511

512+
#mobile-menu {
513+
display: none;
514+
}
515+
410516
p,
411517
.highlight-container,
412518
li {
@@ -428,6 +534,10 @@ mjx-container {
428534
h3 {
429535
font-size: 120%;
430536
}
537+
538+
#mobile-menu {
539+
display: none;
540+
}
431541
}
432542

433543
/* Extra large screens with banner: 1300px and above */
@@ -453,6 +563,10 @@ mjx-container {
453563
h3 {
454564
font-size: 120%;
455565
}
566+
567+
#mobile-menu {
568+
display: none;
569+
}
456570
}
457571

458572
/*

0 commit comments

Comments
 (0)