Hi everybody

Just looking for a couple of words of advice really as I haven't seen
anything on the web that seems to fit what I am looking for.

Basically...I have built a two tier menu system using Jquery to show
and hide the second level when certain parts are clicked.

I was wondering if it was possible to have it's state stay the same
between pages on the site. I.e. have a second level stay open after a
link is clicked and the page changes.

At the moment, as soon as the page changes, the menu closes back up to
default state, which is what would be expected.

My code is as follows.

$(document).ready(function() {
                //Hides Level 2 Menu Tree Elements
        $("div#leftnav > ul > li > ul").hide();

        // TREE MENU EVENT
        $("div#leftnav > ul > li > a").click(function(event) {
                if ($(this).attr("href") == "#" ) {
                        event.preventDefault();
                        if ($(this).next().is("ul") == true ) {
                                var classCheck = $(this).attr("class");

                                $("ul").filter(".active").hide("slow");
                                $("ul").filter(".active").removeClass();
                                $("a").removeClass("active");

                                if (classCheck != "active") {
                                        $(this).addClass("active");
                                        $(this).next("ul").addClass("active");
                                        $("ul").filter(".active").show("slow");
                                }
                        }
                        else
                        {
                                $("ul").filter(".active").hide("slow");
                                $("ul").filter(".active").removeClass();
                                $("a").removeClass("active");
                        }
                }
        })
})


Paul

Reply via email to