Just to note you will probably want to move the js into its own file and enqueue from functions.php, also may want to introduce selector caching & conditional loading so isn't always iterating through every menu item on each page load. Just to keep peak optimisations in mind. Inline js in the header feelsbadman.
That is a nice and simple way to add nice functionality to the mega menu.
Thanks
You bet!
Clever!
Just to note you will probably want to move the js into its own file and enqueue from functions.php, also may want to introduce selector caching & conditional loading so isn't always iterating through every menu item on each page load. Just to keep peak optimisations in mind. Inline js in the header feelsbadman.
Thanks for sharing!