SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I hope someone might be able to help me out. I have an jQuery animated quicklaunch in which I "remember" the open/closed states through use of jQuery cookies. This works well, with the exception of certain instances.

Basically works as planned on every /path1/SitePages/ wiki page as necessary, however

a) when I navigate to a library link in the same site, /path1/Shared Documents/Forms/ or to /path1/Forms/Forms/AllItems.aspx for instance, the cookies for those sub directories kick in which can be in different open/closed states, messing up the user experience.

I just want one set of cookies to determine the open/closed states of my sharepoint site, not competing sub directory cookies.. how is this possible? below is the code I use to apply the cookie..

            $("#s4-leftpanel-content ul.root>li.static>").click(function(){
            var obj =  $(this);
            var parObj = obj.parent();
            var element = $("ul", parObj);
            var show = $(element).is(":visible")?true:false;

            if(!show) {
                    $.cookie($(this).text(), 'expanded');

            } else {
                    $.cookie($(this).text(), 'collapsed');
            return false;
share|improve this question

I've figured this out, and it was mostly my doing that it wasn't working. The answer is to set paths

$.cookie($(this).text(), 'expanded', { path: '/path' , domain: "spdomain" });

I was stumbling on this working because in my code I check first if one item was null so I could apply it to be in a default open/closed state, which was messing everything up.

So, if anyone has the same issue, just add the path: and it will set cookies to that path you specify, and not into different subdirectories.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.