1( function () { 2 var stickyNav = document.querySelector( '.fpbe__sticky-nav' ); 3 if ( ! stickyNav ) return; 4 5 var nav1 = stickyNav.querySelector( '.fpbe__nav--level-1' ); 6 if ( ! nav1 ) return; 7 8 var nav2 = stickyNav.querySelector( '.fpbe__nav--level-2' ); 9 var toggle = nav1.querySelector( '.fpbe__nav-toggle' ); 10 11 function openNav2() { 12 if ( ! nav2 ) return; 13 // Measure the rendered Level 1 dropdown and position Level 2 flush below it 14 var menu1 = nav1.querySelector( '.fpbe__menu--level-1' ); 15 if ( menu1 ) { 16 stickyNav.style.setProperty( '--mobile-nav2-top', 'calc(100% + ' + menu1.getBoundingClientRect().height + 'px)' ); 17 } 18 nav2.classList.add( 'is-open' ); 19 } 20 21 function closeNav2() { 22 if ( ! nav2 ) return; 23 nav2.classList.remove( 'is-open' ); 24 stickyNav.style.removeProperty( '--mobile-nav2-top' ); 25 } 26 27 function open() { 28 nav1.classList.add( 'is-open' ); 29 if ( toggle ) toggle.setAttribute( 'aria-expanded', 'true' ); 30 // Defer so Level 1 menu has rendered and has a measurable height 31 requestAnimationFrame( openNav2 ); 32 } 33 34 function close() { 35 nav1.classList.remove( 'is-open' ); 36 if ( toggle ) toggle.setAttribute( 'aria-expanded', 'false' ); 37 closeNav2(); 38 } 39 40 if ( toggle ) { 41 toggle.addEventListener( 'click', function ( e ) { 42 e.stopPropagation(); 43 nav1.classList.contains( 'is-open' ) ? close() : open(); 44 } ); 45 } 46 47 document.addEventListener( 'click', function ( e ) { 48 if ( ! e.target.closest( '.fpbe__sticky-nav' ) ) { 49 close(); 50 } 51 } ); 52} )();
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.