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
Post a Comment