Style switching demo.

This page is a demo for my Generic Stylesheet Switcher article. You can download the code here: styleswitch.js

Main Idea

A generic approach to stylesheet switching, which allows you to define the strategy with which you want to switch the style (body ID or stylesheet) as well as provide a custom function to decide which style is presented.

So, what just happened?

There are two things going on here. First, when the page loads up, it checks the referrer and sets the stylesheet. The referrer to stylesheet map is currently:

digg.com
digg.css - you should see the digg logo repeating in the background.
stephenminded.com
sm.css - you should see a tiled 45 degree pinstripe pattern at the top of the page.

Secondly, depending on the time of day, the body id is set to morning, afternoon, or evening. The time ranges that govern this are:

morning
06:00 to 11:59
afternoon
12:00 to 16:59
evening
17:00 to 22:00
night
all other times

You can use the links below to switch to the different times of day without changing your clock to see the effect.

Switch to: morning | afternoon | evening | night

Okay, I want to know more.

Head back to the Generic Stylesheet Switcher article for more details on how this all works.