Tabbed Categories
The first category is shown by default, and you can tab through the other categories with the buttons above the category.
Admin CP → Themes → Board Templates → Below the board
<script>
if (document.querySelector('div.forumlist')) {
document.querySelector('div.forumlist').insertAdjacentHTML('beforebegin', `<div id="cat-tabs" style="margin: 1.5rem 0"></div>`);
}
const category = document.querySelectorAll('div[id^="fourm-"]');
const catTitle = document.querySelectorAll('div.category h2 a');
for (let i = 1; i < category.length; i++) {
category[i].style.display = 'none';
}
for (const i of catTitle) {
const tabButton = document.createElement('button');
tabButton.type = 'button';
tabButton.id = 'tab-' + i.parentNode.parentNode.parentNode.id.split('fourm-')[1];
tabButton.className = 'btn btn-secondary btn-sm';
tabButton.style.marginRight = '5px';
tabButton.innerText = i.innerText;
if (document.querySelector('#cat-tabs')) {
document.querySelector('#cat-tabs').appendChild(tabButton);
}
}
const tabButtons = document.querySelectorAll('#cat-tabs button');
for (const element of tabButtons) {
element.onclick = function() {
const forumID = 'fourm-' + this.id.split('tab-')[1];
for (const x of category) {
x.style.display = 'none';
}
document.querySelector('#' + forumID).style.display = 'block';
};
}
</script>
ForumSpark Support