Skip to content

Commit e16c2c8

Browse files
committed
improved mobile responsivenss
1 parent b17da9c commit e16c2c8

File tree

4 files changed

+58
-134
lines changed

4 files changed

+58
-134
lines changed

assets/load/header.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<nav role="navigation" aria-label="Main navigation" class="main-nav">
2-
<button class="menu-toggle" aria-label="Toggle navigation menu">
2+
<button class="menu-toggle" aria-label="Toggle navigation menu" aria-expanded="false">
33
44
</button>
55
<div class="nav-container">

assets/load/universal.css

Lines changed: 45 additions & 126 deletions
Original file line numberDiff line numberDiff line change
@@ -179,29 +179,53 @@ nav ul li {
179179
border-color: var(--accent-color);
180180
}
181181

182-
.nav-container::before,
183-
.nav-container::after {
184-
content: '';
185-
position: absolute;
186-
top: 50%;
187-
transform: translateY(-50%);
188-
width: 15%;
189-
height: 40px;
190-
background:
191-
linear-gradient(30deg, #1a1a1a 12%, transparent 12.5%, transparent 87%, #1a1a1a 87.5%, #1a1a1a),
192-
linear-gradient(150deg, #1a1a1a 12%, transparent 12.5%, transparent 87%, #1a1a1a 87.5%, #1a1a1a),
193-
linear-gradient(30deg, #1a1a1a 12%, transparent 12.5%, transparent 87%, #1a1a1a 87.5%, #1a1a1a),
194-
linear-gradient(150deg, #1a1a1a 12%, transparent 12.5%, transparent 87%, #1a1a1a 87.5%, #1a1a1a);
195-
background-size: 20px 40px;
196-
opacity: 0.5;
197-
}
182+
/* Mobile Styling */
183+
@media screen and (max-width: 768px) {
184+
/* Typography adjustments */
185+
h1 { font-size: clamp(2.5rem, 8vw, 4rem); }
186+
h2 { font-size: clamp(2rem, 6vw, 2.5rem); }
187+
h3 { font-size: clamp(1.5rem, 4vw, 2rem); }
188+
li, p { font-size: 16px; }
198189

199-
.nav-container::before {
200-
left: 2%;
201-
}
190+
/* Mobile navigation */
191+
.menu-toggle {
192+
display: block;
193+
}
202194

203-
.nav-container::after {
204-
right: 2%;
195+
.main-nav {
196+
position: relative;
197+
}
198+
199+
.nav-container {
200+
padding: 0;
201+
}
202+
203+
nav ul {
204+
display: none;
205+
flex-direction: column;
206+
position: absolute;
207+
top: 100%;
208+
left: 0;
209+
width: 100%;
210+
background: rgba(30, 92, 143, 0.95);
211+
padding: 0;
212+
}
213+
214+
nav ul.show {
215+
display: flex;
216+
}
217+
218+
nav ul li {
219+
margin: 0;
220+
width: 100%;
221+
}
222+
223+
.nav-link {
224+
padding: 12px 16px;
225+
font-size: 20px;
226+
border-radius: 0;
227+
justify-content: flex-start;
228+
}
205229
}
206230

207231
/* Section Styling */
@@ -281,108 +305,3 @@ canvas {
281305
z-index: -1;
282306
filter: blur(1px);
283307
}
284-
285-
/* Enhanced Mobile Styles */
286-
@media screen and (max-width: 768px) {
287-
/* Typography adjustments */
288-
h1 { font-size: clamp(2.5rem, 8vw, 4rem); }
289-
h2 { font-size: clamp(2rem, 6vw, 2.5rem); }
290-
h3 { font-size: clamp(1.5rem, 4vw, 2rem); }
291-
li, p { font-size: 16px; }
292-
293-
/* Mobile navigation */
294-
.menu-toggle {
295-
display: block;
296-
}
297-
298-
.main-nav {
299-
position: relative;
300-
}
301-
302-
.nav-container {
303-
padding: 0;
304-
}
305-
306-
nav ul {
307-
display: none;
308-
flex-direction: column;
309-
position: absolute;
310-
top: 100%;
311-
left: 0;
312-
width: 100%;
313-
background: rgba(30, 92, 143, 0.95);
314-
padding: 0;
315-
}
316-
317-
nav ul.show {
318-
display: flex;
319-
}
320-
321-
nav ul li {
322-
margin: 0;
323-
width: 100%;
324-
}
325-
326-
.nav-link {
327-
padding: 12px 16px;
328-
font-size: 20px;
329-
border-radius: 0;
330-
justify-content: flex-start;
331-
}
332-
333-
/* Section adjustments */
334-
section {
335-
max-width: 95%;
336-
padding: 20px 15px;
337-
margin: 10px auto;
338-
}
339-
340-
section.title {
341-
width: 90%;
342-
}
343-
344-
/* Contact section adjustments */
345-
section#contact p a {
346-
font-size: 20px;
347-
}
348-
349-
section#contact p a img {
350-
width: 30px;
351-
height: 30px;
352-
}
353-
354-
/* Navigation container decorative elements */
355-
.nav-container::before,
356-
.nav-container::after {
357-
display: none;
358-
}
359-
}
360-
361-
/* Existing media queries */
362-
@media screen and (min-width: 500px) {
363-
h1 {
364-
font-size: 4rem;
365-
}
366-
h2 {
367-
font-size: 2rem;
368-
}
369-
}
370-
371-
@media screen and (max-width: 768px) {
372-
section {
373-
max-width: 90%;
374-
}
375-
376-
nav ul {
377-
flex-wrap: wrap;
378-
justify-content: space-around;
379-
}
380-
381-
nav ul li {
382-
margin: 5px;
383-
}
384-
385-
#contact p a {
386-
font-size: 24px;
387-
}
388-
}

assets/load/universal.js

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,27 +14,32 @@ document.addEventListener('DOMContentLoaded', () => {
1414
const navLinks = document.querySelectorAll('.nav-link');
1515

1616
navLinks.forEach(link => {
17-
if (link.getAttribute('href') === currentPage) {
17+
// Determine the page the link is pointing to
18+
const linkPage = link.getAttribute('href').split('/').pop();
19+
20+
// Add 'active' class if the link matches the current page
21+
if (linkPage === currentPage) {
1822
link.classList.add('active');
1923
}
20-
24+
2125
// Add hover effect
2226
link.addEventListener('mouseenter', (e) => {
2327
const img = e.currentTarget.querySelector('img');
2428
img.style.transform = 'scale(1.1) rotate(5deg)';
2529
});
26-
30+
2731
link.addEventListener('mouseleave', (e) => {
2832
const img = e.currentTarget.querySelector('img');
2933
img.style.transform = 'scale(1) rotate(0deg)';
3034
});
3135
});
3236

37+
38+
// Toggle mobile navigation
3339
menuToggle.addEventListener('click', () => {
40+
const isExpanded = menuToggle.getAttribute('aria-expanded') === 'true';
41+
menuToggle.setAttribute('aria-expanded', !isExpanded);
3442
navMenu.classList.toggle('show');
35-
menuToggle.setAttribute('aria-expanded',
36-
menuToggle.getAttribute('aria-expanded') === 'true' ? 'false' : 'true'
37-
);
3843
});
3944

4045
// Close menu when clicking outside

projects/header.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<nav role="navigation" aria-label="Main navigation" class="main-nav">
2-
<button class="menu-toggle" aria-label="Toggle navigation menu">
2+
<button class="menu-toggle" aria-label="Toggle navigation menu" aria-expanded="false">
33
44
</button>
55
<div class="nav-container">

0 commit comments

Comments
 (0)