Skip to content

Instantly share code, notes, and snippets.

@joomlapro
Created July 23, 2012 23:19
Show Gist options
  • Save joomlapro/3166889 to your computer and use it in GitHub Desktop.
Save joomlapro/3166889 to your computer and use it in GitHub Desktop.
Pattern Switcher
// Pattern Switcher
if ($.cookie('background') != '') {
var pattern = $.cookie('background');
$('body').css('background-image', 'url(' + pattern + ')');
}
$('.main ul li a').click(function () {
var pattern = $(this).attr('href');
$('body').css('background-image', 'url(' + pattern + ')');
$.cookie('background', pattern, {
path: '/'
});
return false;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment