I am trying to use focus event on list element. it's working with hover, but not with focus! Do you have a idea ?
$('#main-menu ul.rubriques li')
.hover(function() {
$(this).addClass('active').find('ul').show();
})
.focus(function() {
$(this).addClass('active').find('ul').show();
});
i try to modify my code: and find the solution ;) ;) ;)
$('#main-menu ul.rubriques li a')
.hover(function() { $(this).parent().addClass('active').find('ul').show();
})
.focus(function() { $(this).parent().addClass('active').find('ul').show();
});
thanks ! everybody !
Focus is for <input/> elements and <a/> links...
You can also bind both events at once:
$('#main-menu ul.rubriques li').bind('hover focus', function() {
$(this).addClass('active').find('ul').show();
});
But like michelgotta says the focus is unlikely to work on an li except in some circumstances - http://api.jquery.com/focus/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With