Remembering menu status after changing page

Home Forums Older releases 1.0.x Remembering menu status after changing page

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
  • #2655

    Hi guys

    Great menu script, thanks!

    So, I have a collapsed menu:

    Is it possible that, when you change to another page, the page reopens with the last opened options instead of opening the menu with the initial status (everything closed)?



    Nevermind, I have found a way using cookies / bind events / Jquery show&hide.


    Hi, i need the same thing with my menu. But i don’t know how to achieve this. When i click on a menu option, the link loads the new html but when i come back using the back button or a link, the menu option should remain deployed.

    Can you help me? or share part of your code?



    Roberto: each time you open up a menu (bind event show) set up a JS cookie with the sub-menu that was opened. Each time you open a page, check if there’s a cookie set up for a menu option and open it through Jquery. Clear the cookie every time a sub-menu is closed.


    Ixnay, can you be so kind and share an example for this newbie 🙂

    I try with this code but i can’t get it work (i use a cookie example from w3c):

    function setCookie(cname,cvalue,exdays) {
    var d = new Date();
    d.setTime(d.getTime() + (exdays*24*60*60*1000));
    var expires = “expires=” + d.toGMTString();
    document.cookie = cname+”=”+cvalue+”; “+expires;

    function getCookie(cname) {
    var name = cname + “=”;
    var ca = document.cookie.split(‘;’);
    for(var i=0; i<ca.length; i++) {
    var c = ca[i];
    while (c.charAt(0)==’ ‘) c = c.substring(1);
    if (c.indexOf(name) == 0) {
    return c.substring(name.length, c.length);
    return “”;

    function checkCookie() {
    var user=getCookie(“username”);
    if (user != “”) {
    // activate the item and focus it
    $(‘#main-menu’).smartmenus(‘itemActivate’, $(‘a#’ + user));
    $(‘a#’ + user)[0].focus();
    // alert(“id menu ” + user);
    } else {
    user = prompt(“Please enter your menu option:”,””);
    if (user != “” && user != null) {
    setCookie(“username”, user, 30);

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.


You will be emailed a link to set your password.


Lost password?