You've probably seen the Lightbox effect at work during your travels on the web, although you may not have known that it was called Lightbox. Essentially, the visitor clicks on a thumbnail from the image gallery, and a larger version appears on top of the page, dimming out the page's content behind it. This widely-used effect makes use of jQuery and was originally authored by Leandro Vieira Pinho. The actual Lightbox effect will be triggered by hyperlinks that we set on our page. They're very slick, and in this tutorial, you're going to learn how to build one in Dreamweaver!
First, make sure and download the project files for this tutorial. Unzip the file and store the project files in a location that you'll remember, like your desktop. Inside the project files folder you'll find 2 more folders, "assets" and "images". They contain all the components we'll need.
Now, go ahead and launch Dreamweaver and choose Site > New Site to define a new site. When you're defining your site (choosing the Root Folder), make sure to point to the project files folder that you've downloaded.
Next, create a brand new blank file, flip into Code View; then paste the code contained in this 1st text file into the head area of your page.
Now we're ready for the page's structure — that is, the framework that'll hold our thumbnails. Go ahead and paste the code contained in this 2nd text file into the body of your page:
As you can see, there's an outer "lightboxgallery" which contains four thumbnails. If you want to expand your gallery to accommodate more image thumbnails, it's no problem. Just copy and paste the thumbnail code, as many times as you need.
Now we need our thumbnails. Drop your cursor into the first thumbnail and then choose Insert > Image. Navigate into the "images" folder and choose "thumb1.jpg." Repeat this for the other thumbnails.
With our thumbnails in place, it's now time to tie everything together and get the Lightbox script happening. As mentioned earlier, the script for our Lightbox is going to be triggered with hyperlinks, so we'll go and set links for the larger versions of each image and then test our results.
Flip over to Design View, select the first thumbnail graphic; then on the Properties Inspector click 'Browse for File' (the folder icon next to the Link field). Navigate to the corresponding full size image in the "images" folder. In this case, "fullsize1.jpg." Repeat this for each thumbnail, linking each to their full size counterpart.
We're finally ready to test things out! Save your file, and then choose File > Preview In Browser, and then select the browser that you'd like to preview your work in. Once the browser launches, go ahead and try clicking on your image thumbnails. If you followed the steps, the large version of the image will appear in a Lightbox. Cool!
Check out these Dreamweaver Video Tutorials & Download the accompanying project files below: