vincej Posted April 3, 2012 Share Posted April 3, 2012 Hi- I'm totally new to Jquery /Javascript although quite competent with CodeIgniter / PHP. I built a menu with PHP / Mysql. I found some Jquery code out of a SitePoint Book on Jquery ( Novice > Ninja ). In putting the two pieces together it almost works. It slides open and closed. I can navigate on the submenus to the correct destination, but for some curious reason the top Category level will not open the page, even though, I can see when hovering over the Category link that the correct url is being presented. I can't see why this should be - I provide the Jquery and PHP below. Many Many thanks For Any Help You Can Offer ! <script> $(document).ready(function(){ $( '#menu > li > ul' ) .hide() .click(function( e ){ e.stopPropagation(); }); $('#menu > li').toggle(function(){ $(this) .removeClass('waiting') .css('background-position', 'right -20px') .find('ul').slideDown(); }, function(){ $( this ) .removeClass('waiting') .css('background-position', 'right top') .find('ul').slideUp(); }); $('#menu > li').hover(function() { $(this).addClass('waiting'); setTimeout(function() { $('#menu .waiting') .click() .removeClass('waiting'); }, 400); }, function() { $('#menu .waiting').removeClass('waiting'); }); }); </script> <?php if (count($navlist)){ echo "<ul id ='menu'>"; foreach ($navlist as $key => $list){ foreach ($list as $topkey => $toplist){ echo "<li>"; //class='cat' echo anchor("welcome/cat/$topkey",$toplist['name']); if (count($toplist['children'])){ foreach ($toplist['children'] as $subkey => $subname){ echo "<ul>"; // class='subcat' echo anchor("welcome/cat/$subkey",$subname); echo "</ul>"; } echo "</li>";} } } echo "</ul>"; } Link to comment https://forums.phpfreaks.com/topic/260234-need-help-with-nav-drop-down/ Share on other sites More sharing options...
sunfighter Posted April 3, 2012 Share Posted April 3, 2012 php not closed. $navlist not defined. can not run code. Link to comment https://forums.phpfreaks.com/topic/260234-need-help-with-nav-drop-down/#findComment-1333981 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.