We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 21122
    • 153 Posts
    Hi there,

    I’m trying to implement a jQuery accordion using jQuery cookies. The accordion works fine, but I am having some problems with the cookie function.

    Cookies are used to add ’memory’ to the menu, so if I click on a link from the third accordion pane, when the new page opens up, the accordion pane will remain open.

    Its kind of working to an extent, but seems a bit buggy. At the moment, as far as I can tell, its sort of doing something with the cookies, but not working properly. Say I have two panes, I open the first one and click a link to another page. On that next page, the first pane remains open. Then, if I open the second pane and click a link, on the new page, the first pane is open. Then when I click from the first pane, the second pane is open on the new page. Its like the cookie is always one step behind!

    Its hard to explain, but if anyone can help me, I can provide a link to the site via PM.

    I’d be very grateful if anybody could shed some light!

    Thanks
      • 26931
      • 2,314 Posts
      this works without cookies: http://bit.ly/dxP33B
        • 21122
        • 153 Posts
        You mean the accordion remains on its previous state across pages? How does that work?!
          • 26931
          • 2,314 Posts
          with "panes" do you mean first-level entry points in the menu? maybe i didn’t understand you right, the menu i linked to will stay open when you enter the second, or third level, but will close if you choose another entry point (e.g. "accordion03" in the screenshot)
            • 21122
            • 153 Posts
            If you look at http://tiny.cc/tqy5f you can see there is an accordion on the left hand side of the content. Its simply holding the links to the pages for all of the different insurance pages.

            What I want is:

            When the user opens the first section (business insurance) and clicks a link, the business insurance pane remains open. And if the user clicks a link thats inside the second section (personal insurance), that section will remain open on the next page.

            Sorry, its hard to explain! But I think I need cookies working for it to work properly.
              • 16610
              • 634 Posts
              Quote from: sharkbait at Aug 26, 2010, 04:22 AM

              this works without cookies: http://bit.ly/dxP33B

              Absolutely great site for advanced MODx developers! This is the kind of information I would like to read more - "the MODx tricks book". You should add this to MODx Wiki. Thanks!
                Mikko Lammi, Owner at Maagit
                • 26931
                • 2,314 Posts
                thanks Lammikko smiley

                neilp123, i can DM you a link to test the accordion if you want
                  • 21122
                  • 153 Posts
                  Looks like I’ve fixed this issue now, so if anybody wants to know how I did it, drop me a PM.
                    • 29076
                    • 615 Posts
                    Quote from: neilp123 at Aug 26, 2010, 06:03 AM

                    Looks like I’ve fixed this issue now, so if anybody wants to know how I did it, drop me a PM.
                    Why not just post your solution here, for all to see. smiley
                      I think, thererfor I am! But what I am, and why...?