August 22, 2003 · Dan Cederholm

CSS Photo Zoom

After reading Pixy's clever Fast rollovers, no preload needed method for using a single background image for multiple hover states, it got me thinking. What if the concept was used to offer a zoomed view of a thumbnail image, right inline on the page, again using a single image?
Here's the example, where I've created a single JPG image that contains both the thumbnail and zoomed photo below it. I then use Pixy's idea of changing the background-position as well as the width and height for the :hover state to hide the thumbnail, but reveal the larger zoomed photo.
I'm not entirely sure that this is even a practical application of the concept -- but it seems like it could work pretty well in certain circumstances, so I thought I'd throw the idea out there.
What to do with un-styled viewers? I thought that making a "View image" link that points directly to the thumbnail/zoomed photo would be acceptable, then hiding the link text with recently discovered text-indent: -1000em; trick. I'm sure there are other, more elegant things to do with a non-styled view, but this seemed the easiest, without creating an additional separate image.
I've only tested this on Mac: Camino, IE5.2 and Safari.