I currently have the jquery code below that was refi开发者_JS百科ned by RJD22
$('.textResizing ul a').click(function(){
$('.textResizing ul a').removeClass('current');
$(this).addClass('current');
});
I am using the Jquery Cookies Plugin and I would like to know how I can get cookies to remember the current class state after refresh.
Thanks,
Sat
Maybe take a look at this page: Setting cookies with jQuery.
As far as I can see you can set whole objects in a cookie so you can read it out again after refresh and set that class to the element you want.
This would look somewhat like this:
$.cookie("myState", { 'myClassToRemember' : 'current', 'myOtherThingToRemember' : 'someothervalue' });
After the refresh you do something like:
var state = $.cookie("myState"); $('.textResizing ul a').addClass(state.myClassToRemember);
精彩评论