Do we need another lightbox script? Probably not, but I needed a lightbox for my company's website and my own, and although there are plenty available, they all feel a bit over the top compared to what I wanted. Personally, I'm not a fan of the 'expand horizontally', 'expand vertically', 'fade in image' (yawn), 'fade in close button' type lightboxes - I want my image to appear in the middle of the page, at a reasonable size pretty much just after I've clicked on it.
I found this by Emanuele Feronato, and although the title is slightly misleading, it basically does exactly what I want with a tiny amount of code. It doesn't require any images, and even works in IE6! It's only really a starting point, so I took the basic idea, wrapped it in some jquery and this is my result:
All you need to do to get it working is to include the jquery library in your page like this:
then include my script, and add the class 'expandable' to any images you want to expand. For example,
<img src="/images/zaonce.png" class="expandable">
Click the picture for a demo...