-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Added responsive design and animations
- Loading branch information
Showing
3 changed files
with
733 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
// Mobile Menu Toggle | ||
const menuIcon = document.getElementById('menu-icon'); | ||
const navLinks = document.querySelector('.nav-links'); | ||
|
||
menuIcon.addEventListener('click', () => { | ||
navLinks.classList.toggle('active'); | ||
}); | ||
|
||
// Close menu when clicking outside | ||
document.addEventListener('click', (e) => { | ||
if (!navLinks.contains(e.target) && !menuIcon.contains(e.target)) { | ||
navLinks.classList.remove('active'); | ||
} | ||
}); | ||
|
||
// Close menu when clicking a link | ||
document.querySelectorAll('.nav-links a').forEach(link => { | ||
link.addEventListener('click', () => { | ||
navLinks.classList.remove('active'); | ||
}); | ||
}); | ||
|
||
// Smooth scroll for navigation links | ||
document.querySelectorAll('a[href^="#"]').forEach(anchor => { | ||
anchor.addEventListener('click', function (e) { | ||
e.preventDefault(); | ||
const target = document.querySelector(this.getAttribute('href')); | ||
if (target) { | ||
target.scrollIntoView({ | ||
behavior: 'smooth', | ||
block: 'start' | ||
}); | ||
} | ||
}); | ||
}); | ||
|
||
// Add scroll-based animations | ||
const observer = new IntersectionObserver((entries) => { | ||
entries.forEach(entry => { | ||
if (entry.isIntersecting) { | ||
entry.target.classList.add('animate'); | ||
} | ||
}); | ||
}, { | ||
threshold: 0.1 | ||
}); | ||
|
||
// Observe all sections and cards | ||
document.querySelectorAll('section, .grid-card, .education-card, .skill-item').forEach(element => { | ||
observer.observe(element); | ||
}); | ||
|
||
// Handle window resize | ||
window.addEventListener('resize', () => { | ||
if (window.innerWidth > 768) { | ||
navLinks.classList.remove('active'); | ||
} | ||
}); |
Oops, something went wrong.