File size: 938 Bytes
1afc4b6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
  // --------------------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');
  });
});