homepage Welcome to WebmasterWorld Guest from 54.242.126.126
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
Forum Library, Charter, Moderator: open

JavaScript and AJAX Forum

    
Trouble with JavaScript Base dropdown menus
Sarah Atkinson

10+ Year Member



 
Msg#: 3873263 posted 2:57 pm on Mar 18, 2009 (gmt 0)

I have a drop down menu that uses JS to hide sub uls

when it initiates the menu it hides all the sub uls. However I want to be able to over ride this sometimes and have one ul showing on initiation.

function initMenu() {
$('#menu ul').hide();
$('#menu li a').click(
function() {
var checkElement = $(this).next();
if((checkElement.is('ul')) && (checkElement.is(':visible'))) {
checkElement.slideToggle('normal');
return false;
}
if((checkElement.is('ul')) && (!checkElement.is(':visible'))) {
$('#menu ul:visible').slideUp('normal');
checkElement.slideDown('normal');
return false;
}
}
);
}
$(document).ready(function() {initMenu();});

[edited by: Sarah_Atkinson at 2:57 pm (utc) on Mar. 18, 2009]

 

idev

5+ Year Member



 
Msg#: 3873263 posted 9:45 pm on Mar 19, 2009 (gmt 0)

Hello Sarah,

Please post the whole sample page and describe what you wish to achieve.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved