ph4x35ccb

navegaçao por tab

Dec 15th, 2021 (edited)
534
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const tabMenu = document.querySelectorAll('.js-tabmenu li')
  2. const tabContent = document.querySelectorAll('.js-content section');
  3. if(tabMenu.length && tabContent.length){
  4.     function activeTab(index){
  5.     tabContent.forEach((section)=>{
  6.         section.classList.remove('ativo');
  7.        });
  8.        tabContent[index].classList.add('ativo');
  9.     }
  10.     tabMenu.forEach((itemmenu,index)=>{
  11.     itemmenu.addEventListener('click', ()=>{
  12.         activeTab(index);
  13.         });
  14.     });
  15. }
  16.  
Add Comment
Please, Sign In to add comment