-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
83 lines (74 loc) · 3.07 KB
/
script.js
File metadata and controls
83 lines (74 loc) · 3.07 KB
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
// Mobile menu toggle
const mobileMenuBtn = document.querySelector('.mobile-menu-button');
const mobileMenu = document.getElementById('mobile-menu');
const breadcrumb = document.querySelector('.breadcrumb');
const navLinks = document.querySelectorAll('nav a');
const mobileNavLinks = mobileMenu.querySelectorAll('a');
mobileMenuBtn.addEventListener('click', () => {
const isExpanded = mobileMenuBtn.getAttribute('aria-expanded') === 'true';
mobileMenuBtn.setAttribute('aria-expanded', !isExpanded);
mobileMenu.classList.toggle('show');
mobileMenu.setAttribute('aria-hidden', isExpanded);
});
// Navigation update and breadcrumb update on click
function setActiveLink(sectionId) {
navLinks.forEach(link => {
link.classList.toggle('active', link.getAttribute('href') === sectionId);
});
mobileNavLinks.forEach(link => {
link.classList.toggle('active', link.getAttribute('href') === sectionId);
link.tabIndex = link.classList.contains('active') ? 0 : -1;
});
// Update breadcrumb
const name = sectionId.replace('#', '');
breadcrumb.textContent = name.charAt(0).toUpperCase() + name.slice(1);
}
navLinks.forEach(link => {
link.addEventListener('click', e => {
setActiveLink(e.target.getAttribute('href'));
});
});
mobileNavLinks.forEach(link => {
link.addEventListener('click', e => {
setActiveLink(e.target.getAttribute('href'));
mobileMenu.classList.remove('show');
mobileMenuBtn.setAttribute('aria-expanded', false);
});
});
// Resume Tab switching
const tabButtons = document.querySelectorAll('.resume-menu button');
const panels = document.querySelectorAll('.resume-content .panel');
tabButtons.forEach((button) => {
button.addEventListener('click', () => {
// Set active button
tabButtons.forEach(btn => {
btn.classList.toggle('active', btn === button);
btn.setAttribute('aria-selected', btn === button);
btn.tabIndex = btn === button ? 0 : -1;
});
// Show the correct panel
panels.forEach(panel => {
if(panel.id === button.getAttribute('aria-controls')) {
panel.hidden = false;
panel.classList.add('active', 'fade-in');
} else {
panel.hidden = true;
panel.classList.remove('active', 'fade-in');
}
});
});
});
// Portfolio Next/Prev Controls (simple example, single project shown)
const portfolioButtons = document.querySelectorAll('.portfolio-buttons button');
portfolioButtons.forEach(button => {
button.addEventListener('click', () => {
alert('Portfolio navigation button clicked. Add project slider here.');
});
});
// Contact form basic submit handler
const contactForm = document.querySelector('form');
contactForm.addEventListener('submit', e => {
e.preventDefault();
alert('Thank you for your message! This is a demo form submission.');
contactForm.reset();
});