X Course Advisor FREE Course Advisor
(Close)
Watch Tutorials
macProVideo.com
Close
Create a jQuery Image Gallery Lightbox in Dreamweaver

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!


Step 1

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. 


Step 2

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.


Step 3

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.

This code contains the links to the external JavaScript and CSS files that our page will need, as well some additional functionality. Be sure to save your file into the folder you defined as a site above.


Step 4

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.


Step 5

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.


Step 6

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.


Step 7

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:

Create Image Gallery Lightbox Project Files

Geoff Blake

Geoff Blake | Articles by this author

Geoff Blake is a book author, video presenter, designer, and visual artist. As an in demand live-on-stage software educator since 1997, Geoff has taught desktop publishing, web design and graphics courses all over North America and is regarded as an expert in Adobe's Creative Suite applications, as well as in HTML, CSS, WordPress, and related technologies. With his humorous, non-jargonny approach, Geoff produces highly regarded articles, video training and DVDs, and regularly contributes to top industry magazines and websites.

Comments

Sep 15, 2011
Hi there,

I can't seem to find the project files(zip folder) to download, that is needed for this tutorial???
Sep 15, 2011
Rounik
Hi,

They are hyperlinks in the text (in blue) in Step 3, Step 4 and the very last line of this tutorial is a link: "Create Image Gallery Lightbox Project Files".

Just click on these to begin downloading the files.

Hope this helps
Rounik
Sep 15, 2011
Thanks for the previous reply.

I now got that done but I have a website already up but I want to have a lightbox on my photography page in the content area. The content area box is an ap div though, and I did the exact same procedure with the code and all but it doesnt show up when I refresh the page????
Sep 15, 2011
Thanks for the reply.

I have a website up but I want my photography page to have a lightbox, but when I try and do it on the content page which is an ap div, it doesnt seem to show up at all??? Am I doing something wrong with placing the code maybe???

May 13, 2012
Un souci ds votre tuto je ne trouve pas les code a copier coller ds dreamweaver ds le fichier que jai telecharger et dc je peu rien fr sur dream sauf si fo recopier ce que vous avez marquer sur votre excemple tuto
Sep 16, 2012
wow!!!this tutorial was helpful....but what about prev,next,close and loading icons....hope you will provide the tutorials about that...
Jan 12, 2013
azex
hi, 4 images is looks simple. but, how about if the images is hundred over..? do i need to edited one by one? any other way to simplify it.
Jan 13, 2013
Ian
Thanks Geoff,

That's a fantastic tutorial for someone like me who sits more on the creative side but sometimes needs to pretend he is a programmer!!

The code works perfectly well.

I am wondering if there is a fairly simple option - or a tutorial of yours somewhere else - to show how to add descriptive text for each image when it is displayed in the Lightbox, rather than just the "Image 4 of 14" text?

Cheers,

Ian
Feb 25, 2013
Emily
Is there a way to add HTML content (like another webpage) to pop up in the lightbox as well?
You must be logged in to post a comment.
Create an Account  Login Now

What is macProVideo.com?

macProVideo.com is an online education community featuring Tutorial-Videos & Training for popular Audio & Video Applications including Adobe CS, Logic Studio, Final Cut Studio, and more.
© 2018 macProVideo.com
a division of NonLinear Educating Inc.
Link