100-project-100-days-website/100_projects/85-responsive-404-page-not-found/assets/js/main.js
2023-05-17 09:52:41 +03:00
Ask

37 lines
1.1 KiB
JavaScript

{e968e493c8ba5248b81773777cdd576277768052 true 1112 main.js 0xc0084b4f50}

/*=============== SHOW MENU ===============*/
const navMenu = document.getElementById('nav-menu'),
navToggle = document.getElementById('nav-toggle'),
navClose = document.getElementById('nav-close')
/*MENU SHOW*/
if(navToggle){
navToggle.addEventListener('click', () =>{
navMenu.classList.add('show-menu')
})
}
/*MENU HIDDEN */
if(navClose){
navClose.addEventListener('click', () =>{
navMenu.classList.remove('show-menu')
})
}
/*REMOVE MENU MOBILE*/
const navLink = document.querySelectorAll('.nav__link')
function linkAction(){
const navMenu = document.getElementById('nav-menu')
// When we click on each nav__link, we remove the show-menu class
navMenu.classList.remove('show-menu')
}
navLink.forEach(n => n.addEventListener('click', linkAction))
/*SCROLL REVEAL ANIMATION*/
const sr = ScrollReveal({
distance: '90px',
duration: 3000,
})
sr.reveal(`.home__data`, {origin: 'top', delay: 400})
sr.reveal(`.home__img`, {origin: 'bottom', delay: 600})
sr.reveal(`.home__footer`, {origin: 'bottom', delay: 800})