Skip to content

Commit

Permalink
Update the showTabContent f/n in script.js
Browse files Browse the repository at this point in the history
  • Loading branch information
GGayathri3 authored Aug 21, 2024
1 parent 17729c3 commit e1125bb
Showing 1 changed file with 18 additions and 15 deletions.
33 changes: 18 additions & 15 deletions suse2022-ns/static/js/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -587,24 +587,27 @@ function addBugLinks() {
}

function showTabContent(event) {
var tabs = event.target.parentElement;
var tab = event.target.closest('.tab')
if (tab) {
var tabs = tab.parentElement;

// Get the index of the clicked tab
var index = Array.from(tabs.children).indexOf(event.target);
// Get the index of the clicked tab
var index = Array.from(tabs.children).indexOf(tab);

// Hide all tab contents
Array.from(tabs.nextElementSibling.children).forEach(content => {
content.style.display = 'none';
});
// Hide all tab contents
Array.from(tabs.nextElementSibling.children).forEach(content => {
content.style.display = 'none';
});

// Remove "active" class from all tabs
tabs.querySelectorAll('.tab').forEach(tab => {
tab.classList.remove('active-tab');
});
// Remove "active" class from all tabs
tabs.querySelectorAll('.tab').forEach(tab => {
tab.classList.remove('active-tab');
});

// Display the selected tab content
tabs.nextElementSibling.children[index].style.display = 'block';
// Display the selected tab content
tabs.nextElementSibling.children[index].style.display = 'block';

// Add "active" class to the clicked tab
event.target.classList.add('active-tab');
// Add "active" class to the clicked tab
tab.classList.add('active-tab');
}
}

0 comments on commit e1125bb

Please sign in to comment.