Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4583708
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T21:15:10+00:00 2026-05-21T21:15:10+00:00

I coded my own Jquery accordion and I have a problem. I need to

  • 0

I coded my own Jquery accordion and I have a problem.

I need to open the current section again after following the link.

When I click a link some database code fetches the correct data and displays it however since the page has re-loaded the previously open accordion section is now closed.

Does anybody have any recommendations for making use of the ‘$accordionPrev’ value? I tried accessing this var but any requests to make it visible were not working.

I would be very grateful for any help, I have been fighting this all day 🙂

Many thanks

Robert

Jquery:

var $runAccordionOnce = 0; var $accordionPrev;


$(".sidebar_game_header").click(function(){
              if($runAccordionOnce > 0) {

              $accordionPrev.slideUp('normal');
              $accordionPrev.prev().css({'background-position' : 'top left'});

              }


    if($(this).next().is(":hidden")){
              $accordionPrev = $(this).next();
              $(this).next().slideDown('normal');   
              $(this).css({'background-position' : 'bottom left'});
              $runAccordionOnce++;    
    }        

HTML Sample:

<div class="sidebar_game_content_wrapper"><div class="sidebar_game_onepix"></div>
    <div class="sidebar_game_header"><img src="<?php bloginfo('template_directory'); ?>/images/icn_game1.png" alt="Game 1 Icon"/><div class="sidebar_game_header_text">Game 1</div></div>
    <div class="sidebar_game_content"> 

        <ul>
            <li><a href="<?php {echo $url . "&amp;game_id=10&amp;platform_id=3";} ?>">iPhone</a></li>
            <hr />
            <li><a href="<?php {echo $url . "&amp;game_id=10&amp;platform_id=4";} ?>">iPad</a></li>
            <hr />
            <li><a href="<?php {echo $url . "&amp;game_id=10&amp;platform_id=2";} ?>">Mac</a></li>
            <hr />
            <li><a href="<?php {echo $url . "&amp;game_id=10&amp;platform_id=1";} ?>">PC</a></li>
        </ul>
    </div>
</div>
<div class="sidebar_game_content_wrapper"><div class="sidebar_game_onepix"></div>
    <div class="sidebar_game_header"><img src="<?php bloginfo('template_directory'); ?>/images/icn_game2.png" alt="Game 2 Icon"/><div class="sidebar_game_header_text">Game 2</div></div>
    <div class="sidebar_game_content">      
    <ul>
            <li><a href="<?php {echo $url . "&amp;game_id=9&amp;platform_id=3";} ?>">iOS</a></li>
            <hr />
             <li><a href="<?php {echo $url . "&amp;game_id=9&amp;platform_id=2";} ?>">Mac</a></li>
            <hr /> 
            <li><a href="<?php {echo $url . "&amp;game_id=9&amp;platform_id=1";} ?>">PC</a></li>
            <hr /> 
            <li><a href="<?php {echo $url . "&amp;game_id=9&amp;platform_id=6";} ?>">Nintendo DS</a></li>
            <hr /> 
            <li><a href="<?php {echo $url . "&amp;game_id=9&amp;platform_id=5";} ?>">Nintendo Wii</a></li>
            <hr /> 
    </ul>
    </div>

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T21:15:10+00:00Added an answer on May 21, 2026 at 9:15 pm

    Javascript variables do not persist between page re-loads.

    You will have to either

    • pass it in the url (and read it when the page is loaded again)

    or

    • save it in a cookie and access it from the new page.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following problem: On a Button-Click I POST some data to the
I have my own simple equal heights code in jQuery to make two columns
I have coded my own tiny static DAL class for .NET Compact Framework and
I am creating my own jQuery plugin. Here is the code which I have
I have found great jQuery wizard here Jerod Santo blog which suits my need.
I have the following listener set up for pagebeforechange (very similar to the jQuery
I have a simple accordion menu I've put together today using the jQuery slideDown()
I have a code for jqGrid with custom editFunc that opens my own jQuery-UI
I created my own jQuery plugin in 1.4 and now I need a small
I've created my own code for moving windows around, using the following system: mousedown

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.