Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
I am going to hit Copy, copy this to the clipboard. Now, I need to stay within the document ready but outside of the anchor tag clickevent. That goes from here to here. So let's come outside of that area. Still inside the document ready. Let's put a comment for ourselves. We'll just say initialize gallery on load, hit Return, Command+V or Ctrl+V for paste, and we're going to paste in all of these instructions.
So at the very top, we have these declarations. I am actually going to remove these tabs in here, get this formatted so now I can see this ending bracket here ends this statement here. So to begin, let's come up here, and the first four variables, let's just change these to have first_ in front of them.
So let's copy, paste, paste, paste. We're also going to paste these in front of all of the variables within the script. So this becomes first photo preview, on line 43, this becomes first_photo_fullsize, first caption, first photo, first_photo_fullsize, first_photo_caption, first_photo_caption. Next, for the variables up here, since we're not inside that clickevent we don't know which object was actually clicked.
So we're going to change the 'this' in here. Let's delete that, put in two quotes for a string literal. We're going type '.gallery_thumbnails a'. Outside of the parentheses, we're going to type.first(), and then the dot attribute, then the title string literal. This is jQuery's way of going through all of the anchor links and finding the first one in all of the anchor tags inside of the gallery_thumbnails div.
Let's select this entire statement, copy it, come down to fullsize and hit Paste, change title string literal to href. Then just like in the other function, we're actually going to take photo preview and concatenate that by taking photo_ fullsize, doing a string replacement on the full-size text, and putting in preview. Everything else in here is going to run pretty much the same. Let's hit File Save. Let's come over to our browser. Hit Reload.
What we'll see right away is the very first image fades up once it preloads. So I'll just click a few other images here. Let's come back, hit Reload. So now our initial state is working great. Now that our gallery is initializing on load, let's go add an email link and let's add some style to our View larger link.
Get unlimited access to all courses for just $25/month.Become a member
82 Video lessons · 101431 Viewers
61 Video lessons · 88193 Viewers
71 Video lessons · 72061 Viewers
56 Video lessons · 103837 Viewers
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.
Your file was successfully uploaded.