Advertisement
flavius123

menu responsivo

Jul 4th, 2022
722
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const navSlide = () => {
  2.   const burger = document.querySelector('.burger');
  3.   const nav = document.querySelector('.nav-links');
  4.   //Fazendo aparecer os itens
  5.   const navLinks = document.querySelectorAll('.nav-links li');
  6.  
  7.   //Fazendo o clique do menu funcionar
  8.   burger.addEventListener('click', () => {
  9.     nav.classList.toggle('nav-active');
  10.  
  11.     //Animações links
  12.     navLinks.forEach((link, index) => {
  13.       if (link.style.animation) {
  14.         link.style.animation = '';
  15.       } else {
  16.         link.style.animation = `navlinkFade 0.5s ease forwards ${index/7+1.5}s`
  17.  
  18.       }
  19.     });
  20.     //Transformando em X
  21.     burger.classList.toggle('toggle');
  22.  
  23.  
  24.   });
  25.  
  26.  
  27. }
  28.  
  29. navSlide();
Advertisement
RAW Paste Data Copied
Advertisement