jQuery accommodating both HOVER and FOCUS together (mouse and keyboard) -


i'm building mega menu want able trigger menu via both hover (using mouse) , focus (such tabbing via keyboard).

this i'm presently doing:

$(".megamenu-trigger").focus(function (){$(this).hover()}); $(".megamenu-trigger").hover(function(){     // stuff }); 

this works, wondering if that's ideal way handle both keyboard , mouse interactions together.

you can use bind method bind multiple events 1 action i.e.

$('.megamenu-trigger').bind("mouseenter focus mouseleave",          function(event) { console.log(event.type); });  

Comments

Popular posts from this blog

c++ - Convert big endian to little endian when reading from a binary file -

C#: Application without a window or taskbar item (background app) that can still use Console.WriteLine() -

unicode - Are email addresses allowed to contain non-alphanumeric characters? -