Skip to content

Commit

Permalink
Update the showTabContent f/n in script-purejs.js
Browse files Browse the repository at this point in the history
Handled the nesting of HTML elements inside <term>
  • Loading branch information
GGayathri3 authored Aug 21, 2024
1 parent d17ebb0 commit 17729c3
Showing 1 changed file with 23 additions and 20 deletions.
43 changes: 23 additions & 20 deletions suse2022-ns/static/js/script-purejs.js
Original file line number Diff line number Diff line change
Expand Up @@ -678,24 +678,27 @@ function addBugLinks() {
}

function showTabContent(event) {
var tabs = event.target.parentElement;

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

// 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');
});

// 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');
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(tab);

// 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');
});

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

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

0 comments on commit 17729c3

Please sign in to comment.