Skip to content

Instantly share code, notes, and snippets.

Created May 24, 2012 16:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save anonymous/2782458 to your computer and use it in GitHub Desktop.
Save anonymous/2782458 to your computer and use it in GitHub Desktop.
// adicionando e removendo a class "OPEN" para os submenus com click no link
$('.with-submenu > a').click(function(e){
e.preventDefault();
var this_parent = $(this).parent();
this_parent.toggleClass('open');
$(this).closest('#top').find('.with-submenu').not(this_parent).removeClass('open');
$('html').click(function() {
$(this_parent).removeClass('open');
});
$(this_parent).click(function(event){
event.stopPropagation();
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment