Changeset 51072
- Timestamp:
- 06/04/2021 05:06:15 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-content/themes/twentytwentyone/assets/js/primary-navigation.js
r49854 r51072 97 97 var navMenu = function( id ) { 98 98 var wrapper = document.body, // this is the element to which a CSS class is added when a mobile nav menu is open 99 mobileButton = document.getElementById( id + '-mobile-menu' ); 99 mobileButton = document.getElementById( id + '-mobile-menu' ), 100 navMenuEl = document.getElementById( 'site-navigation' ); 101 102 // If there's no nav menu, none of this is necessary. 103 if ( ! navMenuEl ) { 104 return; 105 } 100 106 101 107 if ( mobileButton ) { … … 168 174 } ); 169 175 170 document.getElementById( 'site-navigation' ).querySelectorAll( '.menu-wrapper > .menu-item-has-children' ).forEach( function( li ) {176 navMenuEl.querySelectorAll( '.menu-wrapper > .menu-item-has-children' ).forEach( function( li ) { 171 177 li.addEventListener( 'mouseenter', function() { 172 178 this.querySelector( '.sub-menu-toggle' ).setAttribute( 'aria-expanded', 'true' );
Note: See TracChangeset
for help on using the changeset viewer.