-
Notifications
You must be signed in to change notification settings - Fork 0
/
JS
26 lines (22 loc) · 849 Bytes
/
JS
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
document.addEventListener('DOMContentLoaded', function() {
const links = document.querySelectorAll('header nav ul li a');
const sections = document.querySelectorAll('section');
const joinUsButton = document.querySelector('header button');
function activateSection(targetId) {
sections.forEach(section => {
section.classList.remove('active');
});
document.getElementById(targetId).classList.add('active');
}
links.forEach(link => {
link.addEventListener('click', function(event) {
event.preventDefault();
const targetId = this.getAttribute('href').substring(1);
activateSection(targetId);
});
});
joinUsButton.addEventListener('click', function() {
activateSection('join-us');
});
activateSection('home');
});