Consider a list of thumbnails from which the user clicks one to change the background image. The following scripts lets the user choose a background image and apply it.
$(function() {
$('.themes li a img').click(function() {
var image = 'imgs/someimage.jpg';
//Set cookie
function setCookie(){
$.cookie("html_img", image, {expires:7});
var a = $.cookie('html_img');//get cookie value
return a;
}
});
});
Another script called loadCookie.js loads the cookie which contains the chosen background when the user visits another page:
$(function() {
var startImage='';
startImage = setCookie();
$(document).ready(function(){
$('html').css("background", startImage);
});
});
IE8 says ‘object doesn’t support this action, line 3’; Jquery cookie plugin is installed. I know there is some little mistake I can’t find. Any help making the script work is greatly appreciated.
Not 100% on what you’re trying to do, but I think this is what you’re after (assuming you’re using jquery.cookie.js):