-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathevents.js
46 lines (41 loc) · 1.46 KB
/
events.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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
// logic for menu section
let upcoming = document.querySelector("#Upcoming");
let previous = document.querySelector("#Previous");
let upcomingItems = document.querySelector("#upcoming-items");
let previousItems = document.querySelector("#previous-items");
let events_head = 1;
upcoming.addEventListener("click", () => {
events_head = 1;
updateDisplay();
});
previous.addEventListener("click", () => {
events_head = 2;
updateDisplay();
});
function updateDisplay() {
// Reset styles
upcoming.style.backgroundColor = '';
previous.style.backgroundColor = '';
upcomingItems.style.display = 'none';
previousItems.style.display = 'none';
// Show the appropriate section and change background color
if (events_head === 1) {
upcomingItems.style.display = '';
upcoming.style.backgroundColor = '#6F4E37';
} else if (events_head === 2) {
previousItems.style.display = '';
previous.style.backgroundColor = '#6F4E37';
}
}
updateDisplay();
const subscribeButton = document.getElementById('subscribeButton');
const successMessage = document.getElementById('successMessage')
subscribeButton.addEventListener('click', (event) => {
event.preventDefault(); // Prevent the form from submitting and reloading the pag
// Show the success message
successMessage.style.display = 'block'
// Hide the message after 3 seconds
setTimeout(() => {
successMessage.style.display = 'none';
}, 2000);
});