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

  • Home
  • SEARCH
  • 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 5930301
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T14:32:13+00:00 2026-05-22T14:32:13+00:00

i am using jquery accordion as a menu in asp.net Masterpage. This is jquery

  • 0

i am using jquery accordion as a menu in asp.net Masterpage.

This is jquery

$(document).ready(function() {
    $(".header").click(function() {
        $(this).toggleClass("display");
        $(this).next("div .menu_body").slideToggle(500);
    });
});

This is html.

  <div id="MasterPage_Menu" class="menu_list">
  <p class="header">Header-1</p>
    <div class="menu_body">
        <a href="page1.aspx">Link-1</a>
    </div>
  <p class="header">Header-2</p>
    <div class="menu_body">
        <a href="page2.aspx">Link-2</a>
    </div>
  <p class="header">Header-3</p>
    <div class="menu_body">
        <a href="page3.aspx">Link-3</a>
   </div>
  </div>

According the code above, when the header is clicked, the content (menu_body) will be slided toggle.
The menu_body is hide at default, when the user click on the header, the menu_body is visible.

Example Problem: eg: 2 menu_body is visible, when i click on href = “page1.aspx”, the page will be navigated to page2.aspx but the accordion will return to be default which all the menu_body is hidden.

Since I am using this accordion in master page, i fail to store the value to keep track of the accordion menu_body status into the hiddenfield when the page is navigated away. The value in hiddenfield will be reset.

I am thinking to store this in session, but in client page, it doesn’t allow us to store value into the session.

Any solution for this?

  • 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-22T14:32:14+00:00Added an answer on May 22, 2026 at 2:32 pm

    If you add id attributes to your headers:

    <p class="header" id="header-1">Header-1</p>
        <div class="menu_body">
            <a href="page1.aspx">Link-1</a>
        </div>
    

    Then you can pull the id out in your handler and use jquery.cookie to track the open panel in a cookie:

    $(".header").click(function() {
        var $this = $(this);
        if(!$this.hasClass('display'))
            $.cookie('open_panel', this.id);
        $this.toggleClass("display");
        $this.next("div .menu_body").slideToggle(500);
    });
    

    You’d need to play with the storage format for open_panel a bit if you want to have multiple panels open at one time but a simple CSV list would probably suffice; I’ll leave that part as an exercise for the reader. You’d also want to check the cookie when the page loads and open the appropriate panels.

    You could also keep track of the cookie’s value on the server if you wanted to keep the setting around as part of the user’s account preferences.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple accordion menu using jQuery. When I click a link inside
I'm trying to create an accordion type menu using the following JQUERY: function initMenu()
I'm using this http://www.i-marco.nl/weblog/jquery-accordion-menu/ accordion menu. Problem is, is that the main-menu links only
I have the following jquery that I wrote: $(document).ready(function(){ $('div.contentTxtBox#home').addClass('current').show(); $('a.menu').click(function() { $('div.contentTxtBox.current').hide(slide, {
I'm using the JQUERY UI Accordion module: <script type=text/javascript> $(function() { $(#sidebar_column_accordion).accordion({ fillSpace: true,
I want to create multilevel accordion Navigation using jQuery , I tried using this
I am using this code: $('.ui-accordion').bind('accordionchange', function(event, ui) { $(this).next().next().css({'background-image':'images/green-bg.jpg'}); //ui.newHeader // jQuery object,
Here's the specs: ASP.NET 3.5 using ASP.NET AJAX AJAX Control Toolkit jQuery 1.3.2 web
I am using a JQuery accordion style dropdown menu. However, when JS is disabled,
I'm using JQuery to create a Horizontal Accordion menu (based on the tutorial at

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.