Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
So, whichever anchor link we actually clicked on, we are going to pull into a new variable called photo_caption the title attribute of that object. That's going to give us our caption. var photo_fullsize. It's going to be equal Dollar sign this .attr, and in here we are going to put href, the actual link destination of full size, because we took the thumbnail images and actually linked them to the high-resolution full-size image.
That's where that variable is going to set up. Then lastly, photo_preview. Now, photo_preview would never use the term preview.jpg. So right now in our HTML, there is no way for the browser to know we specifically will have another file size here called preview. So, what we are going to do is concatenate this by string replacing the file name fullsize with the file name preview. So, in order to do that, we are going to grab photo_fullsize, copy this, so photo_preview is going to equal photo_ fullsize.replace, beginning and ending parentheses, semicolon.
That's going to give us the URL to the preview image. Now, on the next line, we are going to actually write the HTML into the page. Dollar sign, tick mark, gallery_preview.html, beginning and ending parentheses, semicolon. Inside of the HTML tag, we are going to put two tick marks for string literal, and we are actually going to write the anchor tag we are going to create.
So, beginning tag a space href =. I am going to put to two full quote marks. I am going to end the tag and then end a tag. Inside the href, I am going to put an x for the moment. Let's add another attribute, title equals two quotes, another x, style equals background-image:url beginning and ending parentheses, semicolon, and let's put an x inside there as well.
Now in places in this string literal where we have Xs, we are going to replace these with the variables. So, let's start with photo_caption. Let's grab this and copy to the clipboard. Let's come down to title. Let's delete the x. Let's put two single tick marks, two Plus signs, and then let's paste the variable inside of there. So, what happens here is we get a concatenation of the string literal and the variables that we set. So, the first part of the statement comes right up to the two tick marks here.
Then lastly, let's come over and grab photo_preview. This is the preview JPEG url. Let's come over to the x in the image url, two ticks, two Plus signs. Then we will paste that in. Let's choose File > Save. Let's make all of our files inside of Dreamweaver are saved. Choose File > Save All. Let's come back to our operating system. Let's grab the index.html file, double-click it, Command+R or Ctrl+R to reload.
And now when I click on each of these images, I see that the image will actually update over on the right-hand side. Again, this is just an anchor link with the background style. And of course, if I roll over it, we can see the pop- up window coming in for the title. So, that works great! In the next movie, we are we are going to actually pick up the caption, and we will populate the caption to go along with the photo.
Get unlimited access to all courses for just $25/month.Become a member
82 Video lessons · 103063 Viewers
61 Video lessons · 89710 Viewers
71 Video lessons · 73351 Viewers
56 Video lessons · 104920 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.