XyberForce
Jul 25 2008, 01:46 AM
Hey guys, one of my clients is looking for a dynamic way to change the background of a site. ie: click on a link and a new background image loads up. How do I do this? As an example:
http://www.purestructure.com/
Andrew
Jul 25 2008, 09:34 PM
Your example is nothing but a link to an mp4 file, which is broken.
Anyways i'm pretty sure you could do this by changing the style sheets. Set a cookie to make it remember. So a little php involved too. Search for PHP Style Switcher and you could get the basic code for it, then just make a couple different style sheets with only background info in it. And leave your main stylesheet alone.
Banjo
Jul 25 2008, 09:42 PM
Trippin7464, i looked at the link before and it was an actual site with a stlye switcher where it just changed the background and it was like that on every page ( I don't know what happened to the site though). So the way you said would work.
Kendalls
Sep 13 2008, 04:46 AM
Try this code:
CODE
<a href="#" onclick="document.body.background='background.jpg';">change background</a>
rockacola
Oct 15 2008, 01:17 PM
Don't know if this example helps:
http://nettuts.com/demos/03_jQueryStyleSwi.../demo/index.phpthe javascript code for this is at:
http://nettuts.com/demos/03_jQueryStyleSwi...tcher.jquery.jsYou may remove other css stylings and just leave the background property.
TehBlizzy
Mar 17 2009, 04:09 PM
http://stgen.zxq.net/You can look at that for some info. To make it change the background image, just change it to the "document.body.background='..' stuff
http://stgen.zxq.net/lol.js <-- The javascript to do the stuff