Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
Inside the ready, we're going to type function, beginning and ending parentheses, beginning and ending bracket. Then we are going to split the brackets. Anything happening inside of here is going to run after jQuery has downloaded all of the HTML code in the page. So, the first thing we want to do is start by targeting all of the anchor tags that are inside of the gallery thumbnails div. Start with the Dollar sign, beginning and ending parentheses, two tick marks for string literal.
I am going to type gallery_thumbnails space a, come outside of the parentheses .click, beginning and ending parentheses here, semicolon. Now, we are adding a click event to all of the anchor tags. Inside of here, we are going to type function, beginning and ending parentheses. Inside of the parentheses, we are going to put a lowercase e.
This is going to capture the event that actually started the click. Beginning and ending bracket and let's split this function. The first instruction inside of the function on the click event for every one of the anchor tags, we are going to type e.preventDefault, beginning and ending parentheses, and a semicolon. This tells the browser to ignore the default behavior that it would do on an anchor link, which in this case so far has been when we click on a thumbnail, the entire page shifts over to the high-resolution thumbnail.
So we are going to tell the browser to not do its basic function on an anchor tag. And then what we want to do is let's set the states of the thumbnails. So, let's start by copying the statement, come down here, Command+V or Ctrl+V to paste, so gallery_thumbnails a. We are going to go through all of these. I am going to type 'removeClass' and put a string literal inside of the parentheses, called selected.
We are going to make sure that none of the anchor tags have the selected class assigned to them. On the next line, let's paste that same statement again. We are going to say all of the anchor tags .children.CSS, beginning and ending parentheses, semicolon. Inside of here, we are going to do one string literal. We are going to type 'opacity' then a comma, then a second string literal and the number 1.
So, we are basically going to add CSS properties to all of the thumbnails, setting the children, the image tag inside of the anchor tag, with an opacity of 1. Add a few more lines. Then we are going to say Dollar sign parentheses, this, which is whatever the item is that was actually clicked on. We are going to say addClass, string literal, selected, and hit Return, Dollar sign this .Children.CSS, beginning and ending parentheses, semicolon, two tick marks for string literal opacity, two tick marks .4, for 40% opacity.
Let's say File > Save. Let's make sure all of our files are saved in Dreamweaver. Choose Save All. Then we are going to come out to the OS. We are going to grab this index file and open it up in a browser. Hit Reload. Now, when I roll over these items, I see the rollover state. When I click on them, whatever item I click on, the border turns white from the selected class we created earlier, and the image inside gets 40% transparent.
Now, with our thumbnails fully functional, let's start on the preview area.
Get unlimited access to all courses for just $25/month.Become a member
82 Video lessons · 101639 Viewers
61 Video lessons · 88392 Viewers
71 Video lessons · 72231 Viewers
56 Video lessons · 103976 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.