return false on parent item click event disables child anchors?
I am trying to disable the default behavior of an anchor tag with # as the href where it returns the screen to the top of the page. Typically, that's done with return false in the javascript.
In this case, I am using the following code on a parent element of a WordPress nav menu to display a submenu. It works great to stop the page from jumping, but none of the links in the sub menu work!
Is there a way to have my cake and eat it too?
Thanks!
- $('.menu-item-68').click( function () {
- $(this).addClass('parentHighlight');
- $('.menu-item-68 .sub-menu').slideToggle(300, function () {
- if($(this).is(":hidden")) {
- $('.menu-item-68').removeClass('parentHighlight');
- }
- }).toggleClass('toggled');
-
- return false;
-
- });