Simon Willison’s Weblog

Javascript free rollovers

I’ve talked about image rollovers on this site before, but I’ve never seen a technique I like half as much as Pixy’s Fast rollovers, no preload needed. Like all good techniques, it’s so simple I’m surprised no one has thought of it before. The trick is that a single image is loaded containing the different rollover states, then positioned as the background of a fixed pixel size link element in such a way that only one of the states is shown. The :hover style simply changes the offset of the background, revealing the secondary (or even tertiary) state.

This is Javascript free rollovers by Simon Willison, posted on 10th September 2003.

Next: PostgreSQL Performance Optimisation

Previous: Andy in the Garden

Previously hosted at http://simon.incutio.com/archive/2003/09/10/jsFreeRollovers