1

I have a script (JQuery) for drop-down list. How to remember the state of the list in a cookie ? Any help much appreciated!
Example on JSfiddle: https://jsfiddle.net/77y7sqwr/

Code below:

$(document).ready(function() {
    $(".ul-dropfree").find("li:has(ul:has(li))").prepend('<div class="drop"></div>');
    $(".ul-dropfree div.drop").click(function() {
        if ($(this).nextAll("ul").css('display') == 'none') {
            $(this).nextAll("ul").slideDown(400);
            $(this).css({
                'background-position': "-22px 0"
            });
        }
        else {
            $(this).nextAll("ul").slideUp(400);
            $(this).css({
                'background-position': "0 0"
            });
        }
    });
    $(".ul-dropfree").find("ul").slideUp(400).parents("li").children("div.drop").css({
        'background-position': "0 0"
    });
});
ArtemDoom
  • 15
  • 3

1 Answers1

1

i create the code with the cookie plugin.Look for cookies under the resources tab in developer screen. Here is a demo: https://jsfiddle.net/77y7sqwr/11/

Yasemin çidem
  • 623
  • 8
  • 17