wee_lightbox rails plugin

August 6th, 2008 by pyrat

Overview

This is a packaged version of lightbox for viewing images on the screen in the popular lightbox design pattern. The plugin includes some view helpers and an automatic install script to make life easier.

Please refer to the lightbox docs for more info. Included are some rails helpers for easy integration into your site. The lightbox javascript is slightly tweaked to configure the location of images and increase the speed of resize.

You can edit lightbox.js to further tweak these if you wish.

Install

If you install from github with rails 2.1+ it will install the files into your public directory. If you install with another method, you may need to issue a recursive copy command manually.

Also this install script is untested on windows.

Usage Example

In your layout add the following in the head section.

<%= javascript_include_tag :defaults %> 
<%= yield :page_includes %>

In your template:

<%= load_lightbox %>

For each image that you would like to make a lightbox to

<%= lightbox_to('/images/small.gif', '/images/large.gif', "Tasty image caption")

If you want to have more than one lightbox on a page and have the lightbox operate with a slideshow between images..

<%= lightbox_to('/images/small.gif', '/images/large.gif', "Tasty image caption", "group_name")

Where group name needs to be the same for all images in the slideshow.

Github project page

3 Responses to “wee_lightbox rails plugin”

  1. Andrew Says:

    Looks like a great plugin – had one issue, though. After following your instructions, the top half of any page in which lightbox_load is included is covered by a large black box. Any ideas on this?

  2. pyrat Says:

    Hi Andrew,

    Any luck solving this? Just noticed your comment.

  3. Double Shot #329 « A Fresh Cup Says:

    […] wee_lightbox rails plugin – This actually seems to work rather well to get Lightbox integrated with Rails. I’m a full-time Rails developer and contributor, available for long- or short-term consulting, with solid experience in working as part of a distributed team. If you’d like to hire me, drop me a line. Links […]

Leave a Reply