📁 File Manager
Editing:
/home/wedigitalindia/public_html/mvskpowdercoating.com/assets/js/main.js
document.addEventListener("DOMContentLoaded",()=>{ const header=document.getElementById("siteHeader"); window.addEventListener("scroll",()=>{ if(window.scrollY>20){ header.classList.add("header-scrolled"); }else{ header.classList.remove("header-scrolled"); } }); document.querySelectorAll('a[href^="#"]').forEach(link=>{ link.addEventListener("click",e=>{ const target=document.querySelector(link.getAttribute("href")); if(target){ e.preventDefault(); target.scrollIntoView({ behavior:"smooth", block:"start" }); } }); }); }); document.addEventListener("DOMContentLoaded", function () { /* ===================================================== ABOUT MOBILE ===================================================== */ const aboutMenu = document.querySelector( ".about-menu-parent" ); const aboutLink = aboutMenu ? aboutMenu.querySelector(":scope > a") : null; if (aboutMenu && aboutLink) { aboutLink.addEventListener("click", function (e) { if (window.innerWidth <= 991) { e.preventDefault(); aboutMenu.classList.toggle("active"); const expanded = aboutMenu.classList.contains("active"); aboutLink.setAttribute( "aria-expanded", expanded ? "true" : "false" ); } }); } /* ===================================================== PRODUCTS MOBILE ===================================================== */ const productMenu = document.querySelector( ".mega-menu-parent" ); const productLink = productMenu ? productMenu.querySelector(":scope > a") : null; if (productMenu && productLink) { productLink.addEventListener("click", function (e) { if (window.innerWidth <= 991) { e.preventDefault(); productMenu.classList.toggle("active"); const expanded = productMenu.classList.contains("active"); productLink.setAttribute( "aria-expanded", expanded ? "true" : "false" ); } }); } /* ===================================================== RESET WHEN GOING BACK TO DESKTOP ===================================================== */ window.addEventListener("resize", function () { if (window.innerWidth > 991) { if (aboutMenu) { aboutMenu.classList.remove("active"); } if (productMenu) { productMenu.classList.remove("active"); } } }); });
Save
Cancel