January 30, 201412 yr I am trying to create a new menu underneath the sites main menu, this new menu is to display the child pages of whatever page you are on... hope that makes sense. If not here is a picture of what I am trying to achieve Hope someone can help me... :-)
January 30, 201412 yr You could create a second navigation list... <nav> <h1>Navigation</h1> <ul> <li><a href="#">Home</a></li> <li><a href="#">About</a></li> <li><a href="#">Leadership</a></li> <li><a href="#">Programs</a></li> <li><a href="#">Gallery</a></li> <li><a href="#">Members</a></li> </ul> <h2>In this section</h2> <ul> <li><a href="#">Charter members</a></li> <li><a href="#">Past</a></li> <li><a href="#">Roster</a></li> <li><a href="#">National</a></li> <li><a href="#">Regional</a></li> </ul> </nav>
January 30, 201412 yr Personally I'd go for using 1 nav list but making the sub menu a sub-list of it's parent list item. Then hide it with css until the parent is hovered, and also use php to force the sub-list to be displayed when on any page within that section of the site by dynamically adding an additional class to the nav element. Then your list would read - <nav> <ul class="top"> <li><a href="#">Home</a></li> <li><a href="#">About</a> <ul class="level_2 <?php echo isset( $results['more_nav'] ? $results['more_nave'] : ''; ?>"> <li><a href="#">Sub-1</a></li> <li><a href="#">Sub-2</a></li> </ul></li> <li><a href="#">Leadership</a></li> <li><a href="#">Programs</a></li> <li><a href="#">Gallery</a></li> <li><a href="#">Members</a></li> </ul> </nav> Then using display: hidden for the 'nav ul li ul li' as the stadard so that the space is reserved for it and the page won't jump around when the sub menu is displayed and when the 'nav ul li a:hover' condition is met also target the 'nav ul li ul li' and set it's display: inline-block. Simply adding classes to the elements makes it far easier to target the level you are trying to action, both php and java can do that dynamically with ease. Edited January 30, 201412 yr by Weedy101
Create an account or sign in to comment