CSC 223 — Authoring for the Web

Light Box

Overview

In this assignment you'll use jQuery to create a lightbox effect on your portfolio page.

Lightbox Example

Note: You may not use a pre-made light-box script for this assignment. You MUST write the lightbox code from scratch.

Assignment

  1. Add a reference to the jQuery library to your portfolio page.

  2. Inside jQuery's "ready" event select all image elements on the page that are inside of portfolio items.

  3. Attach a click event listener to the selection you made in step 2.

  4. Write the necessary code for the function you attached in step 3 to make the image appear in a light box as shown in the example.

  5. Submit the url to your github pages site to MySVU. (This should be something like https://USERNAME.github.io/REPOSITORYNAME).

Hints

1. Create a new div in the page.

2. Add an image to that div.

3. Style the div so that it takes up the entire window and has a translucent black background.

4. Style the image so that it is centered inside the div.

5. Add a click handler to the div so that it is removed from the page when it is clicked on.