-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtab-handler.js
More file actions
29 lines (24 loc) · 1.05 KB
/
tab-handler.js
File metadata and controls
29 lines (24 loc) · 1.05 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
// Tab Navigation Handler
document.addEventListener('DOMContentLoaded', function() {
// Tab navigation
const tabButtons = document.querySelectorAll('.tab-btn');
const tabPanes = document.querySelectorAll('.tab-pane');
// Set Recommendations tab as the default active tab
// Since we only have one tab now, this is straightforward
tabButtons.forEach(button => {
button.addEventListener('click', function() {
// Remove active class from all buttons and panes
tabButtons.forEach(btn => btn.classList.remove('active'));
tabPanes.forEach(pane => pane.classList.remove('active'));
// Add active class to clicked button
this.classList.add('active');
// Show corresponding tab pane
const tabId = this.getAttribute('data-tab');
const tabPane = document.getElementById(tabId);
if (tabPane) {
tabPane.classList.add('active');
}
});
});
// Since we removed the other tabs, we don't need the forecast toggle functionality
});