Day 4: Lightbox
So yesterday we made a simple lightbox for a set of images, which I found hard to follow the lesson somehow.
Assigning jQuery elements to a variable has proven to be extremely useful. For instance this bit of code:
We don't have to continually write out jQuery objects, we can just refer to them in the variables that preceded the block of code where we need them.
We did more appending and we learned about the
method which we passed in the string, ("href") after attaching it to
. We wanted to make sure the image we clicked on in the image gallery would execute the behavior we wanted, which was popping up the lightbox. Using
assured us that we were clicking the linked image attribute in the HTML, and it wouldn't matter which image was clicked. Here is the last part of the code:
© tiff.RSS