I had this working before the latest version of the global top nav bar, but the menu stuff totally changed for it apparently. I got the original version of the menu links script from a CC post, but I can't find it anymore.
You can see my broken script at w:User:Fandyllic/global.js starting at comment "A RECENT UI CHANGE BROKE SCRIPT BELOW!". I fiddled around with it with no luck. My script got a bit complicated, so I might make a new simple version just to get a menu to work again.