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"
});
});