Welcome to WebmasterWorld Guest from

Forum Moderators: open

Message Too Old, No Replies

Trouble with JavaScript Base dropdown menus

2:57 pm on Mar 18, 2009 (gmt 0)

Preferred Member

10+ Year Member

joined:Apr 29, 2003
votes: 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'))) {
return false;
if((checkElement.is('ul')) && (!checkElement.is(':visible'))) {
$('#menu ul:visible').slideUp('normal');
return false;
$(document).ready(function() {initMenu();});

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

9:45 pm on Mar 19, 2009 (gmt 0)

New User

5+ Year Member

joined:Mar 19, 2009
posts: 29
votes: 0

Hello Sarah,

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


Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members