html - Remember multiple divs toggleClass with jQuery Cookie -


i have 2 divs (staticclose , sads). first 1 visible , other 1 hidden. when close first div, second 1 becomes visible , when click second div, first 1 becomes visible. how can use jquery.cookie remember state of divs?

$('.staticclose').click(function(){    $('.static-ad').toggleclass('hide');   $('.sads').toggleclass('hide'); });  $('.sads').click(function(){    $('.static-ad').toggleclass('hide');   $('.sads').toggleclass('hide');  }); 

using jquery.cookie ask in question, like:

$('.staticclose').click(function(){    $('.static-ad').toggleclass('hide');   $('.sads').toggleclass('hide');   $.cookie("last_state", "0", {path: "/"}); });  $('.sads').click(function(){    $('.static-ad').toggleclass('hide');   $('.sads').toggleclass('hide');    $.cookie("last_state", "1", {path: "/"}); }); $(document).ready(function(){   if ($.cookie("last_state") === "1") {     //do whatever want   } else {     //do whatever want   } }); 

Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -