samedi 18 avril 2015

Keep submenu open after clicking a link

How do i make the corresponding sub-menu stay visible after clicking a link?


I should say im using a custom menu in Wordpress - in Wordpress i have added class "first" for all primary menu-items, and class "second" for all links in submenus.


The CSS for .second is:



.second {
display: none;
}


Here is the JQuery:



$('.first > a').click(function(event) {
event.preventDefault();
});

$('.first').click(function() {
$(this).find('.second').show();
});

Aucun commentaire:

Enregistrer un commentaire