HOW TO CREATE A LIGHTBOX USING IMAGES

Download shadowbox-3.0.3.zip (This is the version as of the writing of this tutorial.)

OBJECTIVE: A basic lightbox can be created by using a javascript class library downloaded from the web and then added to a given page.

DOWNLOAD LIGHTBOX AND ADD JAVASCRIPT LIBRARY RESOURCES

CREATE A SERIES OF IMAGES WITH ASSOCIATED THUMBNAILS

ADD IMAGES TO SITE PAGE

Add thumbnail images to page by any method (Insert, Drag-and-drop).  In this example, paragraph tags are used so images are placed on separate lines because they are block level elements.:

CODE VIEW:

<p><img src="images/mustang/blue-thumb.jpg" width="120" height="75" alt="" /></p>


<p><img src="images/mustang/grey-thumb.jpg" width="120" height="75" alt="" /></p>


<p><img src="images/mustang/red-thumb.jpg" width="120" height="75" /></p>

DESIGN VIEW:


ALTERNATIVE:

If thumbnails are not readily available, code can be added to text instead of image:

CODE VIEW:

<p>Blue Mustang</p>

<p>Gray Mustang</p>

<p>Red Mustang</p>

DESIGN VIEW:

Blue Mustang

Gray Mustang

Red Mustang


LINK THUMBNAIL IMAGES TO LARGER IMAGES

ADD JAVASCRIPT TO PAGE

Add the following script in between the <head> tags as separate script tags:
TIP: Instead of writing, copy and paste the code below exactly as is.

<link rel ="stylesheet" type="text/css" href="shadowbox-3.0.3/shadowbox.css">
<script type="text/javascript" src="shadowbox-3.0.3/shadowbox.js"></script>
<script type="text/javascript">Shadowbox.init();</script>

NOTES:

Bonus: To have the light box display other type of media other than the default image format, you can include the formats INSIDE the Shadowbox.init() function:

Shadowbox.init({ language: "it", players: ["qt", "html", "flv", "swf", "iframe", "wmp"] });

The following edit will set the default language to italy and allows the shadowbox to display quicktime, html, etc.

ASSOCIATE IMAGE (or TEXT) TO LIGHTBOX

CODE ONLY FOR FIRST IMAGE SHOWN

SIMPLY EXAMPLE:

<p><a rel="shadowbox" href="images/mustang/red.jpg" title="Red mustang"><img src="images/mustang/red-thumb.jpg"
width="120" height="75" alt="Red"/></a></p>

ADVANCED EXAMPLE:

<p><a rel="shadowbox[MustangThumbs]; options={counterType:'skip',continuous:true,animSequence:'sync'}"
href="images/mustang/red.jpg" title="Red mustang">
<img src="images/mustang/red-thumb.jpg"
width="120" height="75" alt="Red"/></a></p>

TIP: Once you have created the first image and test it in a browser, copy the same code and paste it as many times as you need (in this
case, two more times) and then change the references to the new image (i.e., all red to blue or gray, in this case).

Click images below to see example of lightbox (shadowbox) in action:

Red Mustang

Gray Mustang

Blue Mustang

For text only, add code (highlighted in bold) to link them to lightbox for each text:

CODE ONLY FOR FIRST TEXT SHOWN

SIMPLY EXAMPLE:

<p><a rel="shadowbox" href="images/mustang/red.jpg" title="Red mustang">Red Mustang</a></p>

ADVANCED EXAMPLE:

<p><a rel="shadowbox[MustangText];options={counterType:'skip',continuous:true,animSequence:'sync'}"
href="images/mustang/red.jpg" title="Red mustang">
Red Mustang</a></p>

Red Mustang

Gray Mustang

Blue Mustang

NOTE: The word MustangThumbs has been changed to MustangText so that it would not be included with the images examples.
NOTE: Read info from internet or downloaded resource files from lightbox web site to see how to change or add parameters. For example,
notice the title tag (i.e., title="Red Mustang") that was added to the <a> tag that will show as a title for the lightbox image.

TEST LIGHTBOX

Test by previewing in a browser and clicking on image links.