2009-07-23

Shadowbox.js (It Works)

At last, a Lightbox script that actually seems to work mostly as advertised. The author requires commercial customers to pay for the script, but the fee is more than reasonable. It works with many Javascript libraries (jQuery, MooTools, Prototype, …).

You can use the usual attributes to group images together (rel), give images a caption (title) et cetera.

The only thing I had to figure out to make the script work was that it uses document.write() to load its' dependencies, so you can't initialize Shadowbox in jQuery's $(document).ready() (at least not easily). The initialization script must be put in HTML document body, as in:

<script type="text/javascript"> 
Shadowbox.init();
</script>

See my simple test of Shadowbox.