Spaces:
Running
Running
| // --------------------Insights Tabs Functionality-------------------- | |
| const insightsTabButtons = document.querySelectorAll('.insights-tab-button'); | |
| const insightsContents = document.querySelectorAll('.insights-content'); | |
| insightsTabButtons.forEach(button => { | |
| button.addEventListener('click', () => { | |
| // Remove active class from all buttons | |
| insightsTabButtons.forEach(btn => btn.classList.remove('active')); | |
| // Add active class to the clicked button | |
| button.classList.add('active'); | |
| // Hide all insights content | |
| insightsContents.forEach(content => { | |
| content.classList.add('hidden'); | |
| content.classList.remove('active'); | |
| }); | |
| // Show the selected insights content | |
| const target = button.getAttribute('data-insights-tab'); | |
| const targetContent = document.getElementById(target); | |
| targetContent.classList.remove('hidden'); | |
| targetContent.classList.add('active'); | |
| }); | |
| }); | |