set jqueryUI ThemeRoller cookie

Seems to me that all users prefer a different color scheme for the web apps they work on.  With jQueryUI, the themes are available and can be chosen with the themeswitcher gadget.  Howerver, out of the box the chosen them only lasts as long as the session.  I wanted to change it to last longer.  There are some examples on the web of modifying the jqueryUI code, but I found a simpler fix. Change the jqueryUI cookie expire date

  <script>
 
  $(document).ready(function(){
   
    $('#switcher').themeswitcher(
    {
    onSelect: function(){
     $.cookie('jquery-ui-theme',$.cookie('jquery-ui-theme'),{ expires: 7 });
     }
    });
   
    alert("Current Theme:" + $.cookie('jquery-ui-theme'));
  });
  </script>

Print | posted on Friday, January 27, 2012 8:36 AM