We're going to use basic JavaScript & CSS to change the background dynamically on a ‘per link’ basis.
You can specify background images or use simple background colours; here we are using images.
This example illustrates that this feature can work independently of other containers on the same page.
The initial ‘white flash’ is due to the delay in downloading the background images. Once loaded in to the cache the ‘flash’ disappears.
If you were to use colour values (#000) the change would be instantaneous. Pre-loading images with JavaScript would also combat this issue.
↑ Click on a colour name to change the background of the container ↓
© Copyright 2009 Mike Mackay. All rights reserved.
coding[@]mikemackay.co.uk