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 8338107
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T04:29:32+00:00 2026-06-09T04:29:32+00:00

I have one sliding menu in which I slide some div. In that after

  • 0

I have one sliding menu in which I slide some div.

In that after page refresh or change I want that menu’s state as it is so for that i used cookie.

In that cookie whatever value I get will affect whole class so my all child will appear on screen instead of that selected div.

I made one jsfiddle also for review. check here

function getCookie(c_name) {
var i, x, y, ARRcookies = document.cookie.split(";");
for (i = 0; i < ARRcookies.length; i++) {
    x = ARRcookies[i].substr(0, ARRcookies[i].indexOf("="));
    y = ARRcookies[i].substr(ARRcookies[i].indexOf("=") + 1);
    x = x.replace(/^\s+|\s+$/g, "");
    if (x == c_name) {
        return unescape(y);
    }
   }
  }

function setCookie(c_name, value, exdays) {
var exdate = new Date();
exdate.setDate(exdate.getDate() + exdays);
var c_value = escape(value) + ((exdays === null) ? "" : "; expires=" +  exdate.toUTCString());
document.cookie = c_name + "=" + c_value;
}

var widget2 = $(".widget2"),
box2 = $(".box2");
var inner = $(".inner"),
box = $(".box");

widget2.hide();
inner.hide();


if(getCookie('box2') == 'on'){
widget2.show();
//alert('hi');
}else{
widget2.hide();
//alert('hiiiiii');
} 

if(getCookie('box') == 'on'){
//widget2.show();
inner.show();
alert('hi');
}else{
inner.hide();
//alert('hiiiiii');
}

box2.click(function() {
$(this).next(widget2).slideToggle("fast", function() {
var flag = ($(this).css("display") == 'none')?'off':'on';
  setCookie('box2', flag);
 });
});

var inner = $(".inner"),
box = $(".box");

box.click(function() {
$(this).next(inner).slideToggle("fast", function() {
var flag = ($(this).css("display") == 'none')?'off':'on';
setCookie('box', flag);
 });
});​ 
  • 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-06-09T04:29:35+00:00Added an answer on June 9, 2026 at 4:29 am

    This one is working perfect now. demo

    $(document).ready(function() {
    
    $(".widget2").hide();
    $(".inner").hide();
    
    function getCookie(c_name) {
        var i, x, y, ARRcookies = document.cookie.split(";");
        for (i = 0; i < ARRcookies.length; i++) {
            x = ARRcookies[i].substr(0, ARRcookies[i].indexOf("="));
            y = ARRcookies[i].substr(ARRcookies[i].indexOf("=") + 1);
            x = x.replace(/^\s+|\s+$/g, "");
            if (x == c_name) {
                return unescape(y);
            }
        }
    }
    
    function setCookie(c_name, value, exdays) {
        var exdate = new Date();
        exdate.setDate(exdate.getDate() + exdays);
        var c_value = escape(value) + ((exdays === null) ? "" : "; expires=" + exdate.toUTCString());
        document.cookie = c_name + "=" + c_value;
    }
    
    var widget2 = $(".widget2");
    var box2 = $(".box2");
    if (getCookie('box2cooki')) {
        var id = getCookie('box2cooki');
        //alert('#'+id);
      $('#' + id).next(widget2).slideDown(100);
      $('#' + id).closest('div').next().find('.inner').slideDown(100);
    } else {
        $(".widget2").hide();
        $(".inner").hide();
    }
    
    
    box2.click(function() {
        $(this).next(widget2).slideToggle(200);
        var box2ID = $(this).attr('id');
        setCookie('box2cooki', box2ID);
        //alert(box2ID);
    });
    //$(".inner").hide();
    $(".box").click(function() {
        $(this).next(".inner").slideToggle(200);
    });
    
    //alert(box2ID);
    });​
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a one-page website with sliding panels, some of which have external links.
I have web page in which i want to slide the images problem is
I have one drop down list in my page, which contains two options. What
sliding div using javascript i have three div with some content. i need the
I designed an dropdown sliding menu using jQuery. When on one page I added
i want to use two javascript sliding menu on same page but in both
I have got three pages/divs sliding through (on one index page) using javascript/jquery, and
I would like to have a slide like the one at the home page
I have two Ajax functions that are on the same div, the first one
I have some sliding images that I am having move with .animate. When I

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.