Welcome to WebmasterWorld Guest from 54.160.163.163

Forum Moderators: open

Message Too Old, No Replies

Trouble with JavaScript Base dropdown menus

     

Sarah Atkinson

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

10+ Year Member



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

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

5+ Year Member



Hello Sarah,

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

 

Featured Threads

Hot Threads This Week

Hot Threads This Month