tags:

views:

47

answers:

1

I have a jquery toggle that swap between two layouts. I need to set a cookie so it dosen't reset every time the browser is refreshed. How can I implent this in this script:

<script type="text/javascript"> 

$(document).ready(function(){

$("a.switch_thumb").toggle(function(){
  $(this).addClass("swap"); 
  $("ul.display").fadeOut("fast", function() {
    $(this).fadeIn("fast").addClass("thumb_view");
     });
  }, function () {
  $(this).removeClass("swap");
  $("ul.display").fadeOut("fast", function() {
    $(this).fadeIn("fast").removeClass("thumb_view");
    });
});

});

A: 

You can use a jQuery cookie plugin such as http://www.stilbuero.de/2006/09/17/cookie-plugin-for-jquery/ and set it whenever you perform the toggle. Then on page load you can check the value and show/hide whatever portions of the screen you would like.

T B
And how do I do that?
Dieter
The link I provided shows you how to set the cookie value and get the cookie value. I can't tell you where to do that since I don't know exactly how you want your app to run
T B