Created
August 2, 2013 16:13
-
-
Save harmstyler/6141155 to your computer and use it in GitHub Desktop.
Keyboard accessible dropdown menu.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$.fn.accessibleDropDown = -> | |
el = $(this); | |
enter = -> $(this).addClass('hover') | |
leave = -> $(this).removeClass('hover') | |
# Hover dropdown | |
$("li", el).hoverIntent(enter,leave) | |
# Make dropdown menus keyboard accessible | |
$("a", el).focus( -> | |
$(this).parents("li").addClass("hover"); | |
).blur -> | |
$(this).parents("li").removeClass("hover"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment