bobmcleod (1) [Avatar] Offline
I'm working with the show/hide menu from chapter 5, and have it working for site navigation. But I'm weak on the proper use of conditional logic in jQuery, so maybe someone can put me on the right track for the following problem.
I want the default state of a section to vary,ie to start submenu items hidden in cases where the user-selected item has no sub-menu items, but to start visible if the main li or one of its child items is assigned a currentpage class. The code as it now stands is as follows:

if (this == || $([0] == this) {
if ($(this).children('ul').is(':hidden')) {
else {
cursor: 'default',

I feel a right simpleton for asking this, but I'm stumped, and grateful for any pointers.
mraj (104) [Avatar] Offline
Re: chapter 5 menu conditional logic for currentpage
Hi Bob,
To re-show (unhide) a ul that contains an li with a 'currentpage' class, add this to the bottom of your jQuery code:
$('.currentpage').closest('ul').show(); // requires jQuery 1.3
$('.currentpage').parents('ul').show(); // use this instead for earlier versions

To re-show (unhide) the main li with 'currentpage', add this: