1document.addEventListener('DOMContentLoaded', function () { 2 const menuButton = document.getElementById('primary-mobile-menu'); 3 const siteNav = document.getElementById('site-navigation'); 4 const body = document.body; 5 6 if (!menuButton || !siteNav) return; 7 8 // Funzione per aprire/chiudere il menu mobile 9 function toggleMenu() { 10 const expanded = menuButton.getAttribute('aria-expanded') === 'true'; 11 menuButton.setAttribute('aria-expanded', !expanded); 12 body.classList.toggle('primary-navigation-open', !expanded); 13 body.classList.toggle('lock-scrolling', !expanded); 14 } 15 16 menuButton.addEventListener('click', toggleMenu); 17 18 // Submenu toggles 19 const subMenuButtons = siteNav.querySelectorAll('.sub-menu-toggle'); 20 subMenuButtons.forEach(btn => { 21 btn.addEventListener('click', function (e) { 22 e.stopPropagation(); 23 const expanded = btn.getAttribute('aria-expanded') === 'true'; 24 btn.setAttribute('aria-expanded', !expanded); 25 26 const subMenu = btn.nextElementSibling; 27 if (subMenu) subMenu.style.display = !expanded ? 'block' : 'none'; 28 }); 29 }); 30 31 // Click fuori dal menu chiude tutto 32 document.addEventListener('click', function (e) { 33 if (!siteNav.contains(e.target)) { 34 body.classList.remove('primary-navigation-open', 'lock-scrolling'); 35 menuButton.setAttribute('aria-expanded', 'false'); 36 subMenuButtons.forEach(btn => btn.setAttribute('aria-expanded', 'false')); 37 subMenuButtons.forEach(btn => { 38 const subMenu = btn.nextElementSibling; 39 if (subMenu) subMenu.style.display = 'none'; 40 }); 41 } 42 }); 43});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.