Sha256: dcf087a37f173a2e6996b4251944db2381efb0fa5223d3d302e805f64f059216

Contents?: true

Size: 805 Bytes

Versions: 1

Compression:

Stored size: 805 Bytes

Contents

const navSlide = ()=>{
  const burger = document.querySelector('.burger');
  const navBrand = document.querySelector('.nav-brand');
  const navSlider = document.querySelector('.nav-menu');
  const navLinks = document.querySelectorAll('.nav-link');
  const navBar = document.querySelector('nav');

  // watch for touch clicks on the whole navbar
  navBar.addEventListener('click', () => {
    // animate accordinaly
    navSlider.classList.toggle('nav-active');
    burger.classList.toggle('burger-active');
    navBrand.classList.toggle('nav-active');
    navLinks.forEach((link, index) => {
      if ( link.style.animation ) {
        link.style.animation = ``
      } else {
        link.style.animation = `navLinksFade 0.25s ease-in forwards ${index / 10 + 0.1 }s`
      }
    });
  });
}

navSlide();

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
made-slowly-0.0.1 assets/js/mobile-nav-slider.js