Google Groups Home
Help | Sign in
Message from discussion The simplest of questions I'm sure...
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
robinchesterman@googlemai l.com  
View profile
 More options May 16, 1:51 pm
From: "robinchester...@googlemail.com" <robinchester...@googlemail.com>
Date: Fri, 16 May 2008 10:51:05 -0700 (PDT)
Local: Fri, May 16 2008 1:51 pm
Subject: The simplest of questions I'm sure...
I'm brand new to jquery, and I need a little help with this simple
accordion menu code:

$(document).ready(function(){
                $("dd:not(:first)").hide();
                $("dt a").click(function(){
                        $("dd:visible)").slideUp("slow");
                        $(this).parent().next().slideDown("slow");
                        return false;
                });

});

The html is like this:

<dt><a href="/">Section</a></dt>
       <dd>
            <ul>
         <li><a href="url">Item</a></li>

And so on...

It works nicely, but I don't know how to make it so that when you
click on a section title that is ALREADY open, it will close instead.
At the moment, it will close and then slide open again.

I'm sure there's a simple condition that will fix it, but I'm shooting
in the dark at the moment and can't seem to do it.
Any help much appreciated.


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2008 Google