This repository has been archived on 2025-04-21. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
FalixNodes-Desktop-NP/public/scripts/navigation.js
2025-03-22 22:04:43 -04:00

24 lines
No EOL
717 B
JavaScript
Executable file

// Credit: Tabbed Navigation by Casey Jardin
// Source: https://codepen.io/alpha1337/pen/mxWBpq
setTimeout(() => {
const _tabs = document.querySelectorAll('[data-tab]')
const _content = document.getElementsByClassName('active')
const toggleContent = function() {
if (!this.classList.contains("active")) {
Array.from(_content).forEach( item => {
item.classList.remove('active')
})
this.classList.add('active')
let currentTab = this.getAttribute('data-tab'),
_tabContent = document.getElementById(currentTab)
_tabContent.classList.add('active')
}
}
Array.from(_tabs).forEach( item => {
item.addEventListener('click', toggleContent)
})
}, 1000)