-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
24 lines (20 loc) · 741 Bytes
/
script.js
File metadata and controls
24 lines (20 loc) · 741 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// Function to show the selected section and hide others
function showSection(sectionId) {
// Hide all sections
document.querySelectorAll('.page-section').forEach(section => {
section.style.display = 'none';
});
// Show the selected section
document.getElementById(sectionId + '-section').style.display = 'block';
// Update active nav link
document.querySelectorAll('.nav-link').forEach(link => {
link.classList.remove('active');
});
event.target.classList.add('active');
// Prevent default anchor behavior
event.preventDefault();
}
// Initialize - show home section by default
document.addEventListener('DOMContentLoaded', function() {
showSection('home');
});