I made this a while back.
http://www.commadot.com/jquery/faq.php

I think it does what you want.  You can change the markup to be DD/DT pretty
easily.

Glen

On Nov 30, 2007 8:47 AM, [EMAIL PROTECTED] <
[EMAIL PROTECTED]> wrote:

>
> Ladies and Gentlemen,
>
> Here goes my complete noob question:
>
> I have this demo page:
> http://www.itchycloud.co.uk/panther/
>
> in which I'm using this jquery script:
>
> $(document).ready(function(){
>                $("dd:not(:first)").hide();
>                $("dt a").click(function(){
>                        $("dd:visible").slideUp("slow");
>                        $(this).parent().next().slideDown("slow");
>                        return false;
>                });
>        });
>
> which I found on sniplr:
> http://snipplr.com/view/2208/jquery-collapsible-sidebar-menu/
>
> I would like to modify this script so that when the user clicks on the
> current active - displayed, open - <DT><A> then the appropriate <DD>
> will collapse/hide.
>
> I suppose it should be something like this in pseudo-code:
>
> if current.DT is the previous sibling of current visible DD
> then click function() will close DD;
> else click function() will open next sibling DD
>
> Basically, when there is a lot of content in a given DD I want the
> user to be able to click on the previous sibling DT A and it will
> close that DD. This will prevent a lot of scrolling with some pages on
> the planned website.
>
> TIA for your help. I am really looking forward to learning javascript
> and jquery,
> Adrian
>

Reply via email to