@@ -3,16 +3,14 @@ const navMenu = document.getElementById('nav-menu'),
33 navToggle = document . getElementById ( 'nav-toggle' ) ,
44 navClose = document . getElementById ( 'nav-close' )
55
6- /*===== MENU SHOW =====*/
7- /* Validate if constant exists */
6+ /* Menu show */
87if ( navToggle ) {
98 navToggle . addEventListener ( 'click' , ( ) => {
109 navMenu . classList . add ( 'show-menu' )
1110 } )
1211}
1312
14- /*===== MENU HIDDEN =====*/
15- /* Validate if constant exists */
13+ /* Menu hidden */
1614if ( navClose ) {
1715 navClose . addEventListener ( 'click' , ( ) => {
1816 navMenu . classList . remove ( 'show-menu' )
@@ -71,15 +69,15 @@ let newSwiper = new Swiper(".new-swiper", {
7169const sections = document . querySelectorAll ( 'section[id]' )
7270
7371const scrollActive = ( ) => {
74- const scrollY = window . pageYOffset
72+ const scrollDown = window . scrollY
7573
7674 sections . forEach ( current => {
7775 const sectionHeight = current . offsetHeight ,
7876 sectionTop = current . offsetTop - 58 ,
7977 sectionId = current . getAttribute ( 'id' ) ,
8078 sectionsClass = document . querySelector ( '.nav__menu a[href*=' + sectionId + ']' )
8179
82- if ( scrollY > sectionTop && scrollY <= sectionTop + sectionHeight ) {
80+ if ( scrollDown > sectionTop && scrollDown <= sectionTop + sectionHeight ) {
8381 sectionsClass . classList . add ( 'active-link' )
8482 } else {
8583 sectionsClass . classList . remove ( 'active-link' )
0 commit comments