URL hash attribute triggering action

Hi all,

I am currently learning jQuery and am setting up a site which sells T-Shirts. The products page lists the same T-Shirt in 3 colours:

iMMAculate HTML Prototype / 10.05.11 / Product 1

When the user clicks on one of the colours, e.g. Charcoal, the page loads with the hashtag on the end #Charcoal, so:

iMMAculate HTML Prototype / 10.05.11 / Product 1

Currently I have the page set up so when the user clicks on one of the colour swatches, it loads the images and the colour name onto the page. However, what I would ideally like to have is for the page to load the relevant colour images and h2 span (colour name) that is generated in the URL — sorry does that make sense?

Would really appreciate any help you can offer, perhaps someone could point me in the right direction.

Many thanks
Simon

We use this plugin:
jQuery BBQ: Back Button & Query Library

It provides some nice wrappers around getting/setting hashes and also a cross browser onhashchange event and history.

Thanks Anthony. Have had a read through, that all looks a bit complex to me, I’m not sure where to start :S