• Hi there,

    I need some help with a menu in my custom theme in wordpress.

    I basically have a mainnav and some of the mainnav options will have a subnav. All this is added in the worpress admin area and can change at anytime.

    I need to display the mainnav and if the user selects an option that has a subnav I need to show the subnav for that item. This subnav should only show if the parent for the subnav is active.

    Is there anyway of doing this in wordpress? I have always used php and folders in the past but this is a dynamic created nav.

    Thank you in advance.

Viewing 5 replies - 1 through 5 (of 5 total)
  • I would look at using css Z-index, visibility or display on the a:hover tag for this type of thing.

    http://www.w3schools.com/Css/css_examples.asp

    has some more info.

    Thread Starter froggyfrog

    (@froggyfrog)

    Hi there, thanks for your help. Z-index just layers items and visibility will just hide the menu.

    I need some kind of jquery script to check if the active menu item has a subnav and if yes to show that subnav. The hide the subnav once another menu item is selected.

    Any ideas?

    I have this so far:-

    $(function(){
    	$('ul.subnav').hide();
    
    	$('ul.mainnav a#active').mouseover(function(){
    		$('ul.subnav').show();
    
    	return false;
    	});
    });

    It doesn’t quite work how I want it to tho.

    Any ideas?

    It doesn’t quite work how I want it to tho.

    Any ideas?

    Not really as I don’t know how you want it to work.

    There are lots of JS menu dropdowns/slideouts etc out there at places like codespy and tutorio. See which is nearest your needs and see how they do it.

    Thread Starter froggyfrog

    (@froggyfrog)

    Basically there is a subnav for some of the mainnav items but not all of them.

    When the user selects an option with a subnav I want that subnav to show. If the user selects another option on the mainnav then I need the subnav to not show.

    If you look at this site http://www.claireprice.com. Thats how I need my nav to work. If you click on the Advanced treatments option a subnav appears. If you select Job opportunities then the subnav for the advanced treatments gets hidden.

    Does this help you understand what I’m after?

    Thank you

    Try something like

    http://www.tutorio.com/tutorial/javascript-expanding-menu

    and see it it is what you want.

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘menu with submenu’ is closed to new replies.