// 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)