// Nav Burger toggle document.addEventListener('DOMContentLoaded', () => { // Get all "navbar-burger" elements const $navbarBurgers = Array.prototype.slice.call(document.querySelectorAll('.navbar-burger'), 0); // Add a click event on each of them $navbarBurgers.forEach( el => { el.addEventListener('click', () => { // Get the target from the "data-target" attribute const target = el.dataset.target; const $target = document.getElementById(target); // Toggle the "is-active" class on both the "navbar-burger" and the "navbar-menu" el.classList.toggle('is-active'); $target.classList.toggle('is-active'); }); }); }); function hide_nav() { const $navbarBurgers = Array.prototype.slice.call(document.querySelectorAll('.navbar-burger'), 0); $navbarBurgers.forEach(el => { if(el.classList.contains('is-active')) { el.classList.remove('is-active'); const target = el.dataset.target; const $target = document.getElementById(target); if($target) { $target.classList.remove('is-active'); } } }); } /*===== MENU SHOW =====*/ const showMenu = (toggleId, navId) =>{ const toggle = document.getElementById(toggleId), nav = document.getElementById(navId) if(toggle && nav){ toggle.addEventListener('click', ()=>{ nav.classList.toggle('show') }) } } showMenu('nav-toggle','nav-menu') /*==================== SCROLL SECTIONS ACTIVE LINK ====================*/ const sections = document.querySelectorAll('section[id]') const scrollActive = () =>{ const scrollDown = window.scrollY sections.forEach(current =>{ const sectionHeight = current.offsetHeight, sectionTop = current.offsetTop - 58, sectionId = current.getAttribute('id'), sectionsClass = document.querySelector('.nav__menu a[href*=' + sectionId + ']') }) } window.addEventListener('scroll', scrollActive) /*===== SCROLL REVEAL ANIMATION =====*/ const sr = ScrollReveal({ origin: 'top', distance: '60px', duration: 2000, delay: 200, reset: true }); sr.reveal('.home__data, .about__img, .skills__subtitle, .skills__text',{}); sr.reveal('.home__img, .about__subtitle, .about__text, .skills__img',{delay: 400}); sr.reveal('.home__social-icon',{ interval: 200}); sr.reveal('.skills__data, .work__img, .contact__input',{interval: 200});