Skip to content

Commit b6f1cca

Browse files
committed
Fix menu on mobile not display issues
1 parent 01d13f9 commit b6f1cca

2 files changed

Lines changed: 316 additions & 55 deletions

File tree

docs/css/responsive.css

Lines changed: 136 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -50,25 +50,27 @@ footer {
5050
padding: 20px; /* Add padding for mobile */
5151
}
5252

53-
/* 导航栏响应式样式 */
53+
/* 导航栏基础样式 */
5454
.navbar {
5555
position: fixed;
5656
top: 0;
57-
width: 100%;
58-
background: rgba(15, 15, 15, 0.95);
59-
backdrop-filter: blur(10px);
57+
left: 0;
58+
right: 0;
6059
z-index: 1000;
60+
background: var(--glass-bg);
61+
backdrop-filter: blur(10px);
62+
border-bottom: 1px solid rgba(0, 245, 255, 0.3);
6163
transition: all 0.3s ease;
6264
}
6365

6466
.navbar-container {
65-
max-width: 1200px;
67+
max-width: var(--container-max-width);
6668
margin: 0 auto;
6769
padding: 0 20px;
6870
display: flex;
6971
justify-content: space-between;
7072
align-items: center;
71-
height: 80px;
73+
height: 70px;
7274
}
7375

7476
.navbar-brand {
@@ -78,17 +80,38 @@ footer {
7880
z-index: 1001;
7981
}
8082

81-
.logo {
82-
width: 40px;
83-
height: 40px;
83+
.nav-menu {
84+
display: flex;
85+
list-style: none;
86+
gap: 40px;
87+
margin: 0;
88+
padding: 0;
8489
}
8590

86-
.brand-text {
87-
font-family: 'Orbitron', monospace;
88-
font-size: 24px;
89-
font-weight: 700;
90-
color: #00ff9f;
91-
text-shadow: 0 0 10px rgba(0, 255, 159, 0.5);
91+
.nav-link {
92+
color: var(--text-secondary);
93+
text-decoration: none;
94+
font-weight: 500;
95+
padding: 8px 16px;
96+
border-radius: 4px;
97+
transition: all 0.3s ease;
98+
position: relative;
99+
}
100+
101+
.hamburger {
102+
display: none;
103+
flex-direction: column;
104+
cursor: pointer;
105+
gap: 4px;
106+
z-index: 1001;
107+
}
108+
109+
.bar {
110+
width: 25px;
111+
height: 3px;
112+
background: var(--text-primary, #ffffff);
113+
transition: all 0.3s ease;
114+
border-radius: 2px;
92115
}
93116

94117
/* 桌面端导航菜单 */
@@ -196,74 +219,89 @@ footer {
196219
right: -100%;
197220
width: 280px;
198221
height: 100vh;
199-
background: linear-gradient(135deg, rgba(15, 15, 15, 0.98), rgba(30, 30, 30, 0.98));
200-
backdrop-filter: blur(20px);
201-
border-left: 1px solid rgba(0, 255, 159, 0.2);
202-
flex-direction: column;
203-
justify-content: flex-start;
204-
align-items: flex-start;
205-
padding: 100px 30px 30px;
206-
gap: 0;
207-
transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1);
222+
background: rgba(10, 10, 10, 0.98);
223+
backdrop-filter: blur(15px);
224+
-webkit-backdrop-filter: blur(15px);
225+
border-left: 2px solid rgba(0, 245, 255, 0.3);
208226
box-shadow: -10px 0 30px rgba(0, 0, 0, 0.5);
227+
flex-direction: column;
228+
justify-content: center;
229+
align-items: center;
230+
gap: 30px;
231+
padding: 80px 20px;
232+
z-index: 1000;
233+
transition: right 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
234+
overflow-y: auto;
209235
}
210236

237+
/* 菜单激活状态 */
211238
.nav-menu.active {
212239
right: 0;
213240
}
214241

242+
/* 导航项样式 */
215243
.nav-item {
216244
width: 100%;
217-
margin-bottom: 20px;
245+
text-align: center;
246+
margin: 0;
218247
}
219248

220249
.nav-link {
221250
display: block;
222-
padding: 15px 0;
223-
font-size: 18px;
224251
width: 100%;
225-
border-bottom: 1px solid rgba(255, 255, 255, 0.1);
252+
padding: 15px 20px;
253+
font-size: 1.1rem;
254+
color: var(--text-secondary, #b0b0b0);
255+
text-decoration: none;
256+
border-radius: 8px;
226257
transition: all 0.3s ease;
258+
text-transform: uppercase;
259+
letter-spacing: 1px;
260+
font-weight: 500;
227261
}
228262

229-
.nav-link:hover {
230-
padding-left: 10px;
231-
border-bottom-color: rgba(0, 255, 159, 0.5);
263+
.nav-link:hover,
264+
.nav-link.active {
265+
color: var(--neon-blue, #00f5ff);
266+
background: rgba(0, 245, 255, 0.1);
267+
text-shadow: 0 0 10px var(--neon-blue, #00f5ff);
268+
transform: translateX(10px);
232269
}
233270

234-
.nav-link::after {
235-
display: none;
271+
/* 汉堡菜单动画 */
272+
.hamburger.active .bar:nth-child(1) {
273+
transform: translateY(7px) rotate(45deg);
274+
background: var(--neon-blue, #00f5ff);
236275
}
237276

238-
/* 添加移动端菜单动画 */
239-
.nav-item {
277+
.hamburger.active .bar:nth-child(2) {
240278
opacity: 0;
241-
transform: translateX(20px);
242-
transition: all 0.3s ease;
279+
transform: translateX(-20px);
243280
}
244281

245-
.nav-menu.active .nav-item {
246-
opacity: 1;
247-
transform: translateX(0);
282+
.hamburger.active .bar:nth-child(3) {
283+
transform: translateY(-7px) rotate(-45deg);
284+
background: var(--neon-blue, #00f5ff);
248285
}
249286

250-
.nav-menu.active .nav-item:nth-child(1) { transition-delay: 0.1s; }
251-
.nav-menu.active .nav-item:nth-child(2) { transition-delay: 0.2s; }
252-
.nav-menu.active .nav-item:nth-child(3) { transition-delay: 0.3s; }
253-
.nav-menu.active .nav-item:nth-child(4) { transition-delay: 0.4s; }
287+
/* 防止菜单打开时背景滚动 */
288+
body.menu-open {
289+
overflow: hidden;
290+
height: 100vh;
291+
}
254292

255-
/* 移动端菜单遮罩 */
293+
/* 遮罩层 */
256294
.nav-overlay {
257295
position: fixed;
258296
top: 0;
259297
left: 0;
260298
width: 100%;
261299
height: 100%;
262-
background: rgba(0, 0, 0, 0.5);
300+
background: rgba(0, 0, 0, 0.6);
301+
z-index: 999;
263302
opacity: 0;
264303
visibility: hidden;
265304
transition: all 0.3s ease;
266-
z-index: 999;
267305
}
268306

269307
.nav-overlay.active {
@@ -279,18 +317,61 @@ footer {
279317
}
280318

281319
.nav-menu {
282-
width: 100vw;
283-
right: -100vw;
284-
padding: 80px 20px 30px;
320+
width: 100%;
321+
right: -100%;
285322
}
286323

287-
.brand-text {
288-
font-size: 18px;
324+
.nav-link {
325+
font-size: 1rem;
326+
padding: 12px 15px;
327+
}
328+
}
329+
330+
/* 确保在大屏幕上恢复正常显示 */
331+
@media (min-width: 769px) {
332+
.hamburger {
333+
display: none !important;
289334
}
290335

291-
.logo {
292-
width: 30px;
293-
height: 30px;
336+
.nav-menu {
337+
position: static !important;
338+
width: auto !important;
339+
height: auto !important;
340+
background: none !important;
341+
backdrop-filter: none !important;
342+
border: none !important;
343+
box-shadow: none !important;
344+
flex-direction: row !important;
345+
justify-content: flex-end !important;
346+
gap: 40px !important;
347+
padding: 0 !important;
348+
z-index: auto !important;
349+
transition: none !important;
350+
overflow: visible !important;
351+
}
352+
353+
.nav-item {
354+
width: auto !important;
355+
text-align: left !important;
356+
}
357+
358+
.nav-link {
359+
display: inline-block !important;
360+
width: auto !important;
361+
padding: 8px 16px !important;
362+
font-size: 1rem !important;
363+
text-transform: none !important;
364+
letter-spacing: normal !important;
365+
font-weight: 500 !important;
366+
}
367+
368+
.nav-overlay {
369+
display: none !important;
370+
}
371+
372+
body.menu-open {
373+
overflow: auto !important;
374+
height: auto !important;
294375
}
295376
}
296377

0 commit comments

Comments
 (0)