Skip to content

Instantly share code, notes, and snippets.

@ashhitch
Created August 27, 2014 11:12
Show Gist options
  • Select an option

  • Save ashhitch/bdf547c917ef5597b6f4 to your computer and use it in GitHub Desktop.

Select an option

Save ashhitch/bdf547c917ef5597b6f4 to your computer and use it in GitHub Desktop.
Make drop down navigation more accessibile via tabs. Uses Bootstrap classes
//If on dropdown link keep it open
$( document ).ready(function() {
$("ul.dropdown-menu li a").on('focus', function() {
$(this).closest('ul.dropdown-menu').addClass('show');
});
$("ul.dropdown-menu li a").on('blur', function() {
$(this).closest('ul.dropdown-menu').removeClass('show');
});
});
// Show on focus
ul.nav li.dropdown a:focus + ul.dropdown-menu {
display: block;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment