I’m having trouble spotting an issue where this jQuery menu breaks when hovering between the three main tabs. The menu works if i hover in, then hover all the way out before selecting another tab…
I think the problem may have to do with scope of a variable (called “n” in the jQuery) or the setTimeout() method.
I’m having trouble spotting an issue where this jQuery menu breaks when hovering between
Share
Yes, use
var n = ...instead of justn = ...to create a local variable.The way you’re currently accessing the
nvariable, as a string being evaluated after the timeout, requires a global variable, however. It’s better if you define it as a function that can draw upon variables from the local scope:Demo