Adding Accordian Navigation!? How to get child pages to work..
-
Hey guys,
I am trying to add a dynamic navigation bar that will allow for children pages to be revealed when the parent page is clicked. It works with regular html, but when you click on the parent when using php in wordpress, the accordian starts to open, but then goes to the page’s parent and won’t work to reveal the child pages. Its a local install, but here is some of the code. THANK YOU!! ??
THE SIDEBAR.PHP HAS THIS…..
<div id="nav"> <li> <?php wp_list_pages('sort_column=menu_order&title_li=&depth=2'); ?></li> </div> <!--nav-->
THE JQUERY CODE……
function initnav() { $('#nav ul').hide(); $('#nav li a').click( function() { $(this).next().slideToggle('slow'); } ); } $(document).ready(function() {initnav();});
THE CSS…………
/* NAV STYLE */ #nav { margin-top: 20px; width: 100px; padding: 0px; font-size: 11px; text-transform: uppercase; color: #666; list-style: none; } #nav a { font-weight: normal } #nav ul { text-decoration: none; list-style: none; } #nav ul li { margin-left:-35px; text-decoration: none; } #nav ul li a { text-decoration: none; } #nav ul li a:hover, .nav ul li a:active { } #nav ul li a.current { text-decoration: none; } #nav ul li a.current:hover { cursor: default; } #nav li a { text-decoration: none; color: #666; font-size: 12px; } #nav li a:hover{ color: #F60} #nav li ul li a{ font-size: 10px; } #nav li ul li{ padding-bottom: 1px}
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Adding Accordian Navigation!? How to get child pages to work..’ is closed to new replies.