Tutorial :switch body background using jquery?


i want to make a body background switcher using jquery. you will have some buttons and each will change the body bg according to your choice. and i want to make it so like that it will save a cookie so that it can retrieve user's choice when you change the page.

first part i got it useing .addclass or .css but i am stuck on the svaing user's choice part.

(sorry for my english)


Also have a look at the Cookie plugin for jQuery, which allows you to do stuff like this:

$.cookie('the_cookie', 'the_value'); // Create a session cookie ("the_cookie") and set its value to "the_value"  $.cookie('chocolate_chip_cookie', 'the_value', { // create a cookie with all available options      expires: 7, // expires in seven days      path: '/', // accessible from the whole site...      domain: 'jquery.com',      secure: true // ...but only on a https connection  });  $.cookie('the_cookie', null); // delete the session cookie  


Have a look at this article which should help you with saving/retreiving and delteing cookies:


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »