I need an array in 'indArray [];' enter the values of the variable 'valCookie' - i.e. indexes on a click, so that the array would keep the cookies and the state of the menu was saved when clicking on the links. How to me to implement competent data drift in an array?
$(document).ready(function () { //index array var indArray = []; var indToCookie; var valCookie; // take index click element $('ul > li > span').click(function() { indToCookie = $('ul > li > span').index(this); $.cookie('nav-item', indToCookie); valCookie = $.cookie('nav-item'); }); $('ul.list-1 > li > span').click(function() { $("ul.list-1 ul").toggleClass('active'); }); });