Please see http://www.laerdalmail.com/dev/discoversimulation/needs/# for an example of the menu in question:
When a topic is clicked, and a sub menu drops down, is it possible to have any other open topic automatically close? Below, I have included the function that handles the dropdown for review.
function Reveal(a, orig_height) {
var ul = a.parentNode.getElementsByTagName("ul").item(0);
$(ul).animate({
height: 'toggle',
opacity: 'toggle'
}, 'slow', function() {
if ($(ul.parentNode).height() < orig_height) {
$(a).css('backgroundPosition', '0 0');
}
});
}
You can close all parents at the start of your function, then open the one triggered.