Lightbox
November 1st, 2008

Lightbox is an image display method developed by Lokesh Dhakar. It is designed as an alternative to using pop-up windows for displaying images. The lightbox method uses a veil to hide the page contents and then overlays the image on top of the page. View the demo to get a sense of how it works.

View Lightbox Demo

Download the zip file containing the scripts and support files. The version hosted here is 2.04. Please check the author’s site for the most current version.

Download Lightbox 2

The download file contains:

/css/lightbox.css The CSS stylesheet
/images/* Various image files
/js/builder.js
/js/effects.js
/js/prototype.js
/js/scriptaculous.js
/js/lightbox.js
The script files
index.html Instructions and an example

You will need to upload all the files in the /css and /js folders to your site. You can change the destination folders to those already on your site if you wish, but if you do, make a note of the folder name(s) you use as this will be needed to configure your SiteSpinner page. The /image folder contains files required for execution and for the example index.html file. Of the image files, you need to upload: closelabel.gif, loading.gif, nextlabel.gif, and prevlabel.gif. The lightbox.js script file expects to find the images it needs in the /images folder. If you decide to upload these files into the standard SiteSpinner /image file or another folder of your choice, you will need to edit the lightbox.js file and change the image path to your destination folder.

If you want to preview the page, be sure to copy the script, CSS, and image files into your preview folder using the same folder structure as you would on your site.

Usage

In a custom header, enter the following:

Make sure the lines specifying the script files are entered exactly in the order shown. Each script builds upon the previous file, so if they are loaded out of order, errors will occur and the lightbox will not work. If you do not use the default folder names for the uploaded files, be sure to modify the path names so the files can be located on your site.

The lightbox works from a link. This can be either an image link or a text link as shown in the demo. Using the Link Editor, or the Object/Quick Edit Link tab, select the “[ file ]“ Link Type and then use the “Find File” button to locate the image associated with this link. Then in the Code field, enter:

rel="lightbox"

If you want a caption displayed with the  image, enter your desired text in the “Assign a Title” field. For example:

You can construct a manual slideshow from your images by using the grouping method when specifying your lightbox images. The syntax for this is:

rel="lightbox[my-group]"

where my-group is any name you wish to use, but it must be the same name for all images to be used in the slideshow. In the example above, you can see I have a slideshow using images placed in “grp2″. You can have multiple groups of different images to create multiple slideshows by using different group names.

SiteSpinner Gotchas

While using the lightbox with SiteSpinner is fairly easy, there are a few things you must keep in mind. The primary item is that SiteSpinner will not output anything in the Code field of a link unless that object is a link; i.e., just adding the rel=”lightbox” statement by itself will not enable the lightbox to work. The object must also be a link.

You should not use the “Pop-up full-sized image” option on an image link. This will cause both the lightbox effect and pop-up window to appear.

Images used in a lightbox slideshow  are displayed in the order they are added to a page; i.e., their z-order. If you re-position images on your work page, be sure they are displayed in the correct sequence by using the “To Front” and “To Back” buttons.

SiteSpinner will only include the link’s title attribute if you enter something in that field. If you use the field on one image for a lightbox caption and do not use it on another image, the title value for the previous image will be used for the missing title caption. This will result in erroneous captions being displayed. If you decide to use lightbox captions and do not want to caption all of your images, you should still enter a blank title using the keyboard spacebar.


3 Responses to “Lightbox”

    Andy Morrison says:

    Thanks for the message – actually just checked and SS does create the IMAGE folder and not IMAGES as is required for lightbox.

    I have tried putting the “images” from the images folder in every concievable way but only the swirling loading image is shown – no close image or the image description etc?

    Looking at the site on IE and it’s even worse – very weird indeedy!

    Any suggestions…

    http://www.dressimpress.co.uk (only 1 image just now as i am still building the site)

    thanks in advance

    Andy p.s perhaps i should have taken this to the SS forum (my apologies but your site here is a “mecca” for all us SS users :o )

    Andy

    admin says:

    The loading, close, prev, and next images are referenced by the lightbox.css file and are expected to be in a folder named image located at the same directory level as the css folder; i.e.,

    root
    |
    —- css (contains lightbox.css)
    |
    —- image (contains required lightbox images)

    Note that SiteSpinner uses a standard image folder named images and not image. If you are adept as scripting, you could place the required lightbox images in the standard SS folder and modify the lightbox.css file to point to that folder instead.

    If you are using SS-Pro, yes using a Code object and setting the code placement option to “in Header” is equivalent to using a standard SiteSpinner custom header.

    Andy Morrison says:

    Hi there, I have uploaded the lightbox files to my server (so far so good) and used the “find file” option to choose what the lightbox should show when the image is clicked.

    So far I get the black background and the new image – but no sign of the “loading” images, previous, next or close images?

    I have used the default images folder so i would have presumed they are all there?

    Should the IMAGES folder be inside the JS folder?

    Also instead of using a CUSTOM PAGE HEADER for the JS code is it ok to use the “add code” and tell SS to put that code in the HEADER?

    Many thanks in advance.

    Andy

Leave a Reply

Spam protection by WP Captcha-Free


May 24th, 2012