Viewers: in countries Watching now:
Join Chris Converse as he teaches how to add a wraparound effect to your homepage marquee with Dreamweaver and a concise bit of jQuery code. The course covers positioning the photos, adjusting the navigation, activating the marquee, and making sure the marquee auto-plays. In a few short movies, designers can learn how to add this dynamic feature to their web sites.
For more information on creating the marquee, please watch Create an Interactive Homepage Marquee with jQuery and Dreamweaver.
Now that we are finished cloning and rearranging our photos, let's add a few more lines after those last two statements. And now let's set up the positioning of all of the photos inside of the marquee-photos div. So let's start by typing dollar sign, parentheses, tick marks inside for a string literal .marquee_photos, space, img. So now we want to search for all of the images that are now inside of that marquee-photos div. Outside of the parentheses, type .each, parentheses, semicolon.
Inside the parentheses for each, we are going to type function, parentheses, and then beginning and ending bracket. Let's split that open on the brackets. Let's back up and inside of the parentheses for function we are going to type index. This way we will have a count for each image that's found inside of marquee-photos. The first thing we are going to do inside of here is declare a variable, var, space, photoPosition. We are going to set that equal to index multiplied times window.photoWidth, then a semicolon.
Next line, dollar sign, parentheses. Inside of the parentheses, we will type this.css, beginning and ending parentheses semicolon. Inside of the parentheses for CSS, two tick marks for a string literal, type left. Outside of string literal but still inside of the parentheses, type a comma, and then two more tick marks, and then the letters px for pixels.
Now let's come outside of the string literal but still on the right side of the comma. And let's type photoPosition. So we are going to add that variable in there and then hit a plus sign. So what we are doing here is taking the value of photoPosition and adding px to it so this becomes a CSS property value. Next line, dollar sign, beginning and ending parentheses, tick marks inside for a string literal, .marqeee_photos. Outside of the parentheses, .css, beginning and ending parentheses, semicolon.
Inside of the parentheses for CSS, two tick marks for a string literal, width. Outside of the string literal but still inside of the parentheses for CSS, comma, two tick marks again for string literal, then the letters px. Now before the string literal we are going to have to come in here and calculate how wide this outermost container needs to be hold all the photographs that are inside. So let's come up to photoPosition. Let's copy that variable name. Let's paste that before the string literal.
So we are going to take photoPosition+ window.photoWidth and then a plus sign and add the px. So after these statements, all six photographs are going to be positioned inside of the marquee-photos div, and the marquee -photos div width the setting is going to be set to be wide enough to encompass six photos instead of four we had in the previous version of this course. Now the last adjustment we need to make is when somebody goes to this marquee, when the marquee loads, we want them to see the second photo, because that's actually the first photo in the four sets of photos that are part of our marquee.
But the way this script is written now, it'll take the first photo and place that in place, which is actually our last photo, because we actually manipulated the position of that up here on line 47. So to make that adjustment, let's hit a few line returns after the statements we just made. Let's start with the dollar sign, beginning and ending parentheses, tick marks for a string literal .marquee_ photos. Outside of the parentheses .css, beginning and ending parentheses, semicolon.
Inside of CSS, we are going to type two tick marks for a string literal, left, outside of the first string literal hit a comma, two tick marks for another string literal, let's put a minus sign, then type two plus signs, then two tick marks for another string literal, then the letter px. Now inside of the two plus signs we are going add window.photoWidth. So now what this statement is doing is after we've rearranged all of the photographs we are going to go through and take the marquee-photos, set the CSS property with a left value of a negative photo width +px.
So this is going to take the marquee- photos when the marquee loads and move it -700 pixels to the left. So when the initial screen loads we are going to see the second photo, which is going to be the picture that we have for London. Now we are at the point where we can test this, so let's save our file. Let's go back to our operating system, and let's take the index.html file and open this up in a browser. Now when this loads in a browser we will notice that our timePassed variables are not counting up because we have disabled the auto play by commenting out that set interval. And we will notice that we see the London photograph with the London caption in place.
So if you can imagine thinking back to the introduction video, we are actually looking at the second photo up here in the photo lineup. The very first photo is the picture of Milan, which is actually the last of the four sequence photos. And there is a sixth photo on the very end, which is a copy of this particular London photo. And these photos on the individual ends are going to give us that wraparound effect. So now at this point our initial screen loads properly, but what you might notice if you start clicking around on the individual pictures, the photos aren't actually going to be compensating for the fact that there are six in here and we only have four navigation items.
So as I go through here and click the navigation items, the pictures aren't going to match up properly with the navigation items. In the next movie, we will start creating our compensation scripts inside our navigation so that we actually go between the proper four photos.
Find answers to the most frequently asked questions about Add a Wraparound Effect for a Marquee with jQuery and Dreamweaver .
Here are the FAQs that matched your search "" :
Sorry, there are no matches for your search "" —to search again, type in another word or phrase and click search.
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.