Create Animated Rollovers with jQuery

Create Animated Rollovers with jQuery

with Chris Converse

 


In this project-based course, author Chris Converse brings interactivity to a sample video gallery using the open-source JavaScript library jQuery. Working in a coding environment, Chris shows how to animate the captions and play icon, extend the thumbnails into filmstrips, and modify the filmstrip backgrounds to change on rollover using CSS.

Take a look at the finished web site here.
Topics include:
  • Updating the CSS to prepare for animated captions
  • Adding the jQuery hover statement
  • Setting a JavaScript timer
  • Animating the thumbnail filmstrip backgrounds

show more

author
Chris Converse
subject
Web, Web Design, Projects
software
jQuery
level
Intermediate
duration
29m 26s
released
Oct 20, 2011

Share this course

Ready to join? subscribe


Keep up with news, tips, and latest courses.

submit Course details submit clicked more info

Please wait...

Search the closed captioning text for this course by entering the keyword you’d like to search, or browse the closed captioning text by selecting the chapter name below and choosing the video title you’d like to review.



Introduction
Previewing the project across browsers and devices
00:02Hi! This is Chris Converse and this is a course I am creating some animated
00:06rollovers for your web site using jQuery.
00:09So I want to start by opening up the final project inside of the exercise files
00:12and take a look at what we are going to be creating throughout the course.
00:15In the first option we are going to be using jQuery to simply change elements
00:18that are already on the screen and we are actually going to use content from a
00:22previous course called Creating an Interactive Video Gallery as content for the course.
00:26Of course, you can use these same techniques in any web site targeting any HTML elements.
00:31Now in the video course we had captions that were over top of these thumbnails.
00:35In this course we are going to take those captions and move them off the stage
00:39so that we can't see them over top of the individual thumbnails and when I roll
00:42my cursor inside of the thumbnails we are going to animate those captions up.
00:45We are also going to take the play icons, set their transparency to about 50%,
00:50and then we are going to bring the opacity of those up as well.
00:53In addition if captions have different heights we are actually going to move the
00:56play icon so that it overlaps the caption box by the same amount each time.
01:00So when I roll over the next thumbnail, which is a three line caption, you will
01:04notice the icon will move up as well.
01:06If I roll into a caption that's only got one line of the copy the icon will move
01:10down again to make the relationship of the play icon and caption the same.
01:18Now in the second option we are going to change the background picture of
01:21the thumbnail as well.
01:22So let me open up option_ 2 inside of our browser.
01:25Now the first thing you will notice in the lower left is we have a timer that's
01:27constantly counting and if I roll my cursor inside of the thumbnails we will see
01:31that the background graphic of the thumbnail is changing in addition to the
01:34animation of the play icon and the animation of the caption.
01:38Now as I roll into each one of these we will be switching the background
01:41graphics using CSS changes from jQuery and this will give us a little bit of a
01:48more dynamic feel for the individual keyframes for the video.
01:51Now since we are standardizing on jQuery here we do get the same user experience
01:56across different platforms.
01:57If we move over here into Windows 7 running IE9 I am going to take option_2 and
02:04just drag that into a browser and take a look at the same user experience
02:07running on Windows in IE9.
02:09Next, we will move over to Windows XP.
02:12Now over in XP we are going to get the same user experience inside of IE7 and 8 as well.
02:16However, there's one thing that we can't support inside of 7 and 8 and that is
02:20setting transparency on an already semi-transparent PNG file.
02:24So one thing you will notice when I roll into each one of these icons is once
02:27the icon has some transparency applied to it through CSS and through jQuery we
02:32will get this black halo that shows around the outside of the PNG file.
02:36When I roll away the PNG file will pick up its semi-transparency, but we won't
02:40be able to get rid of that black halo.
02:42Now if you do want to have this user experience consistent for IE7 and 8 as well
02:46during the course I'll show you the places in the JavaScript where we can make
02:49this change so that we are not setting opacity for the play icons.
02:53So with that I hope this course sounds interesting and if so let's get started
02:56with the first movie.
Collapse this transcript
Using the exercise files
00:01When you download the exercise files those are going to be our four folders
00:03contained inside that the zip.
00:05First is the Art Templates folder which contains the source Photoshop files for
00:08creating the filmstrip versions of the thumbnail graphics.
00:11Filmstrip Thumbnails contains the exported JPEG in case you don't want to go
00:14through the process of saving out the Photoshop files.
00:18Final Project, we took a look at in the introduction video and then lastly is
00:21the Previous Final Files.
00:23These or all of the files that we created in an earlier course called Creating a Video Gallery.
00:28So in this course we are going to start from that previous project in order to
00:31get a starting point for creating our animated rollovers in jQuery.
00:34Now in the next movie we will start by duplicating the previous final files to
00:37the desktop and then beginning our project.
Collapse this transcript
Setting up the project folder and files
00:00Now to begin our project inside of the exercise files I am going to Option+Drag
00:03a copy of previous final files to the desktop.
00:07You can also choose copy/paste.
00:10Once the files have been completed I am going to rename that folder
00:11myAnimatedRollovers.
00:12We are going to open this up and I will just size this a little bit.
00:21Now inside of the Previous Final Files project we have the index.html and inside
00:28of the includes directory we have our JavaScript file and our CSS file, the two
00:32main files that we are going to be making changes to, to change our user
00:35experience that have animated rollovers using jQuery.
00:38Now that we have all of our project files in place in the next movie we will
00:41start modifying some of these files to create our new user experience.
Collapse this transcript
1. Setting Up a New Project in Aptana Studio
Downloading and setting up Aptana Studio
00:00In this course we are going to be coding in a tool called Aptana Studio.
00:03You can follow along with any text, or web editor that you choose or if you want
00:07to download a free copy of Aptana Studio you can go to Aptana.com and download a
00:11copy for Macintosh or Windows.
00:13When you download and install this particular editor one of the things that it
00:17has is the capability to change themes.
00:20By default, Aptana Studio 3 has this really dark background.
00:24I am going to come up to the Aptana Studio 3 menu on the Mac, or you can choose
00:28the Preferences under the Window menu on Windows, come down to Aptana, come
00:34down to Themes and inside of here I can change the themes that this is going to be using.
00:39For this course I would like to go back to Aptana Studio 2.X. This is going to
00:43give me a white background and it's going to let the color coding really show
00:46and be a lot easier for you to follow along.
00:48Once I've made this change I am going to click OK.
00:51Now every time I launch Aptana Studio it's going to use this particular theme
00:54inside of the darker background.
00:55Now that we have our editor set up, in the next movie we are going to start by
00:59creating a new project and continuing on.
Collapse this transcript
Creating a new web project in Aptana Studio
00:00Now that we have our project files ready let's launch Aptana Studio.
00:04Now if you prefer to take this course in a more visual oriented web tool like
00:07Adobe Dreamweaver, you can find this same course using Dreamweaver inside of
00:11Aptana Studio in the lynda.com Library.
00:13Now inside of Aptana Studio let's come up to the File menu, let's choose New>Web Project.
00:24Let's name this My animated Rollovers.
00:31Let's uncheck the Use default location.
00:33Let's choose Browse.
00:36From the desktop let's choose myAnimatedRollovers, click Open.
00:39This warning here is Aptana's way of letting us know that there are files that
00:42exist in that location.
00:44Let's choose Finish.
00:46Once the project opens we can see all of the assets over here in the left-hand
00:49side inside of Aptana and in the main window here in the File tab.
00:52So we can see the index.html file is open.
00:55Now that we have our project created, in the next movie we will start by working
00:59with the CSS file in order to update the user experience of this project.
Collapse this transcript
2. Updating the CSS File
Updating the CSS to prepare for animated captions
00:00Now look at this project in its current state let's come under the Commands menu.
00:04Let's go to HTML>Open Document in Default Browser which is Command+Shift+P or
00:09Ctrl+Shift+P in Windows and inside of our browser we can see our icons here and
00:16we can see the captions with their caption background and as I rollover this I
00:19can see, I get just the border highlighted.
00:22Again, this is exactly the state of the thumbnails in the previous course
00:26creating an attractive gallery with jQuery.
00:27So at this point let's switch back to Aptana Studio.
00:32Let's open of the includes directory.
00:34Let's open up video_gallery.css and let start making some of our CSS changes.
00:39So to start let's come down to a.videoLink div.caption.
00:43These are the captions that are showing up inside of the anchor tags with
00:46the videoLink class.
00:48First thing we want to do is come in here and change 180 to 165.
00:53Next we want to come over here to the padding and set top to 20, we want to set
00:57the right to 20, bottom to 15, left to 15.
01:03We want to come down and set the bottom property here change that to top and
01:09change the value to 116.
01:10What this is going to do is take the div and position it down to 116 pixels.
01:17Now since our video links are only 115 pixels tall this means the captions is
01:21going to be outside of the thumbnail area.
01:24Now in order to hide these we want to come up to the a.videoLink class, add another line.
01:30We're going to set an overflow to hidden that way the captions are going to be
01:36outside of the viewable area and then hidden from the browsers.
01:39So the a.videoLink class is going to actually act like a mask.
01:44The last thing we want to set on the image.play rule is after left we want to
01:47come in here hit Space, we're going to add an opacity of 0.5.
01:54Now as I mentioned in the introduction video this particular opacity setting on
01:58an image that the ping that has transparency applied to it already, is not going
02:02to work inside IE7, 8.
02:04So if you want to support IE7 and 8 then don't set the opacity setting on
02:08the image.play rule.
02:10Now with all of these rules set let's come up to the File menu, let choose
02:13Save All, let's go back over to our browser, let just hit Reload, and what we
02:18should see now is all of the play icons are now 50% transparent and the
02:22captions while still in the page are now moved down 216 pixels and then their
02:27overflow is set to hidden.
02:28So we don't actually see any of the captions.
02:31Now that we have the CSS rules modified, in the next movie we'll start updating
02:34the JavaScript files.
Collapse this transcript
3. Animating the Captions with JavaScript
Adding the jQuery hover statement
00:00Next we're going to go over to the video_ gallery.js file and open that up inside of Aptana.
00:06So what we're going to do inside of here we're going to add a new function
00:11inside of the (document).ready.
00:12So let's add a few lines inside of the document ready and what we're going to do
00:15is start by typing $('a.videoLink').
00:25We're going to target all of the video links outside of the parentheses we're
00:29going to type dot hover beginning and ending parentheses, semicolon.
00:35So the way the hover function works inside of jQuery is that we put to functions
00:38inside of these parentheses.
00:40The first function controls the mouse over, the second function controls when
00:44the mouse leaves the item.
00:46Let's split this open.
00:47Next we're going to type function (){}, hit Return, put in our second function(){},
01:05and then get rid of the extra space.
01:09So the first function we're going to a split open in the brackets.
01:13Now the statement we put inside up here are only going to happen when the user
01:16rolls their mouse into the anchor tag with a videoLink class.
01:20Now before we set up anything for animation I want to bring up a sketch.
01:23So we're going to need to calculate how we want to actually animate these captions.
01:27So what we're going to be doing is we're going to be taking the height of the
01:30thumbnails which is 115 pixels, we're going to take the height of the caption,
01:35we're also going to add 20 pixels from the top and 15 pixels from the bottom
01:40which is 35 pixels, subtract that from the 115 and get 80 pixels.
01:45We're going to add another 5 pixels for padding across the bottom.
01:49So what this basically means is we're going to take 85 pixels, we're going
01:52to subtract the height of the caption, and get the new top point so that we
01:57know where we have to animate the captions in order to make them fit within
02:00the thumbnail area.
02:01We're also going to take the icons and move the icons into place as well so that
02:05the icons always overlap about 18 pixels based on the height of the caption.
02:10So now back in Aptana Studio what we're going to do inside of this first
02:14function we're going to set a variable, caption position.
02:21That's going to equal 85 - $ (this).children('.caption').
02:32So we're going to look for the caption div inside of the item that we are
02:43actually rolling over, which is defined by this .height();.
02:53Next line we're going to set another variable iconPosition.
02:58We're going to set that equal to, let's come up here and copy
03:02the captionPosition.
03:05Let's paste that down here, and then we're going to subtract 32 pixels.
03:11Those PNG graphics are 50 pixels by 50 pixels.
03:14So if we offset that an additional 32 pixels we will get an 18 pixel overlap.
03:18So now that we have the two variables that we need for setting the captionHeight
03:21and the iconHeight, in the next movie we'll actually set the animation positions
03:25so we can actually see these animating on rollover states.
Collapse this transcript
Animating the play icon and captions
00:00Now inside of the first function which happens when we first roll over the item
00:06let's hit a new line and what we want to do here is animate the caption based on
00:10the variables that we just set.
00:13So we're going to start by typing $(this).children('.caption').animate();.
00:20Inside of the parentheses we're going to type a beginning and ending bracket {}.
00:42Inside of the brackets we're going to type top:.
00:44Then we're going to come up here and we're going to copy captionPosition to the clipboard.
00:52After colon we're going to paste in captionPosition.
00:54Than we're going to type a plus sign two tick marks for the string literal and
00:59inside of the string literal we're going to type px for pixels;
01:03outside of the brackets, but still inside of the parentheses comma 250 milliseconds.
01:10So over the course of a quarter of a second we're going to animate the top value
01:16of the caption to whatever the captionPosition is which is being set up here.
01:21On the next line $(this). children('img.play').animate(top:).
01:40We're going to come up here and select the variable name iconPosition.
01:52Copy that to the clipboard.
01:55Paste that after the semicolon, plus sign, two tick marks for a string literal.
02:02Inside of the tick mark we're going to type px for pixels.
02:06Outside of the string literal hit a comma.
02:08We're going to type opacity:1.
02:15Now again if you want this to work in IE7 and 8, you can leave out the
02:17opacity setting here.
02:20Outside of the brackets comma 250 milliseconds and then a semicolon at the end.
02:26So when we roll into this object, the children inside of the object that we
02:29actually roll into which match caption which is that div and the image which has
02:34the play icon are going to be animated to the values that set up here for these
02:38particular variables.
02:39Now when our mouse leaves the individual anchor tag with the video link, jQuery
02:43is going to run this function.
02:45So let's split the second function open and I'm going to quickly come up here
02:50and select both lines of code here.
02:54Copy these to the clipboard.
02:55Let's come down here and paste them.
02:57So what I'm going to do down here is under top I'm going to get rid of the
03:01variable that's been placed in here.
03:03I'm going to leave the string literal and we're going to set this to 116
03:08pixels, which is basically going to animate it back to where it was when we first started.
03:14For icon position I'm going to remove that as well.
03:18And the pixel set inside of here, we're going to set this to 25.
03:25Over to opacity we're going to bring that back down to 0.5. At this point let's
03:30choose File>Save All.
03:32Let's switch back over to our browser, hit Reload and now we should see when
03:36we roll over these the captions animate up and the icons will actually move
03:41into place so that they overlap wherever the caption ends up, at about 18 pixels overlap.
03:46Now that that works with completed option one that we looked at in the
03:52introduction video.
03:54In the next movie we'll extend up these thumbnail graphic into more filmstrip
03:57style graphics, and then we'll start modifying the JavaScript to actually
04:00animate the backgrounds as well.
Collapse this transcript
4. Modifying Thumbnail Graphics as Filmstrips
Extending the thumbnail into filmstrips
00:00Now to animate the thumbnails what we're going to do is create really wide
00:03thumbnails and have an individual screen shot from the video at 200 pixels wide each.
00:09So to set up these art files inside of the Art Templates folder inside of the
00:12exercise files I've these Photoshop files where we have taken individual screen
00:17shots and scale them down.
00:19So I want to open up one of these files and show you how this is set up.
00:22So in the layers panel here I've a clipping area for each of the
00:25individual thumbnails.
00:27So if I turn off all of the layers in the artwork you'll see this black square here.
00:31If I Command+Click on this, go to the Window menu, and bring up the Info panel,
00:37you can see that these are set to 200 pixels wide by 115 which is exactly the
00:41size of our thumbnails.
00:42Then we have Smart Objects here clipped into each one of these items.
00:46So if I turn on layer 1 Smart object.
00:48If I double-click this item and open up that Smart object I can see the full
00:52size here that we actually cut and paste from the video. Let's close that.
00:57Now back in our main area we can see that that piece of artwork is clipped
01:00grouped into this area.
01:03Then I took that same item, extended the canvas out to 1,000 pixels and put five
01:07images at 200 pixels wide.
01:09So we have 1,000 wide by 115 tall pixel image.
01:13Now I've set these up for each of the individual thumbnails and saved these out
01:17as individual JPEG files.
01:19So I'm going to close the Photoshop file and inside of Filmstrip Thumbnails
01:23these are the saved out thumbnails.
01:27Let's hold the Shift key, select all of these.
01:29Let's Option+Drag or cut and paste all of these over into the Video directory.
01:33Each one of these items is going to be replaced.
01:35I'll just click Replace for each one of these items and now we have
01:40thumbnails for each one of these videos that is now again 1,000 pixels wide
01:44by 115 pixels tall.
01:47Back in the exercise files I'm just going to close up these folders.
01:49Now that we have our extended thumbnail graphics which are going to act more
01:53like Filmstrips in the next movie we'll modify the JavaScript file to change the
01:57CSS positioning of those items in the background, in addition to animating the
02:01captions and the play icons.
Collapse this transcript
5. Animating the Thumbnail Backgrounds
Setting a JavaScript timer
00:00Now in order to create the effect of getting the background thumbnail graphics
00:04to animate we're actually going to be taking those large graphics we just
00:07created in Photoshop and moving them back and forth based on a set interval
00:11timer that we're going to set inside of JavaScript.
00:13So in order to get that to work much like what we're seeing here inside of our
00:17sketch we're going to be creating a setInterval and a function and then
00:21assigning a class to any item that we roll over.
00:23Then if we're rolled over an item, we're going to use that setInterval to
00:27reposition the background graphic.
00:29So back in Aptana Studio there's a few things we're going to need to set up in
00:32order to make this happen.
00:34So above the document ready I'm going to start by creating a new variable
00:39called thumbnailPosition.
00:40I'm going to set thumbnailPosition equal to 0.
00:47So as soon as the script runs that's going to be the first variable that's going to be set.
00:51Next, I'm going to add a custom function.
00:53So we're going type function animateThumbnail(){}.
01:10Let's split that open.
01:11Now inside of here we're going to set a new variable var newPosition
01:20that's going to equal;
01:21let's come up here and copy thumbnailPosition. Let's hit copy.
01:27Now in order to access a global variable inside of JavaScript we need to put
01:30window.thumbnailPosition.
01:34So newPosition = window. thumbnailPosition * which is multiplication.
01:42We're going to multiply that by -1.
01:47What this is going to do is give us a negative number for the X value.
01:50So that each time this interval is going to run, it's going to set the position
01:54of the background to a minus number on the X. So it's going to move it the left.
01:57Now on the next line we're going to want to set some debugging code so we can
02:02actually see the value of newPosition showing up on the homepage.
02:06So in here we're going to type $('p.debug').html();.
02:17Then inside of html.
02:23Let's grab newPosition variable copy that and let's paste it.
02:29Now let's switch over to the index.html and let's put a place inside of the html
02:33for that variable to go.
02:34Let's hit a Return right before the Hidden DIV container html comment.
02:39Let's add a paragraph tag.
02:43Inside we'll type test, inside of the p tag we'll type class = debug.
02:53Next, we'll type style equals we'll say color:#fff for white. Let's hit Save.
03:06Let's come back to video gallery.js.
03:08So now this debug value of newPosition is going to be set to that
03:11particular paragraph style.
03:12So we can again save it on the homepage when this is running.
03:16Now we the thumbnail variable created in animateThumbnail inside of the
03:20(document).ready we want to use a setInterval command inside of JavaScript to set a timer.
03:25So we're going to type setInterval()(;).
03:33Inside of setInterval we're going to come up here and select animateThumbnail
03:38the name of that function.
03:40Let's paste it inside of the parentheses, hit a comma, and put in 500 milliseconds.
03:47So what this is going to do is set a timer that's going to be running the whole time.
03:51This is going to run two times a second every 500 milliseconds and two times a
03:56second it's going to run the animateThumbnail function, which is going to
03:59declare a newPosition based on the thumbnailPosition times -1, and then it's
04:03going to let us know what that is by setting that debug value.
04:07So now we have the setInterval in place our custom function and the variable name.
04:11In the next movie we'll add a conditional statement inside of the JavaScript to
04:14test where the actual thumbnail is being positioned.
Collapse this transcript
Animating the thumbnail filmstrip backgrounds
00:00Now to control where the thumbnails are actually being placed and where they are
00:03being animated and for us to be able to test whether or not the animated state
00:07is on the last thumbnail, let's come inside of the animate thumbnail function.
00:12Let's hit a few Returns above where we declare the variable new position.
00:16We are going to type if().
00:22Let's split the brackets open.
00:25Inside of the parentheses where we are going to write our condition let's select
00:30window.thumbnailPosition variable.
00:32Let's copy that, paste in inside of here.
00:36So if window.thumbnailPosition space is less than 800, and again remember that
00:42the X value is always on the left-hand side.
00:44So 800 plus the 200 width of the graphic will give us 1,000.
00:50If the thumbnailPosition is less than 800, let's paste
00:53window.thumbnailPosition += 200, which means it's going to take the current
01:00value and add an additional 200 pixels.
01:03So as long as it's not 800, it's going to add 200 each time.
01:08After the bracket we are going to type }else{.
01:13So if it is not less than 800, let's paste window position again.
01:17We are going to set that equal to 0 and then a semicolon.
01:20At this point let's hit File>Save.
01:24Let's switch over to our browser and hit Reload.
01:27Now we can see in the lower left-hand corner the work test has now been replaced
01:31with the counting interval and we can see that the numbers are counting up by
01:35200 and remember we are taking a value and then multiplying it by -1.
01:39So each of these values here is -200, -400, -600, -800.
01:44When it gets to -800, the next value goes back to 0.
01:50Now that our set interval is working properly let's go back to Aptana Studio.
01:54Now if there are set interval working properly when it gets to -800, it
01:58actually switches back to 0.
01:59What we are going to do here is after the debug line let's add a new line and
02:06what we are going to do down here is type $('a.VideoLink.hover').
02:19So any video links with the hover class.
02:22We are going to type .css outside, beginning and ending parentheses, semicolon.
02:28We are going to set the css property, two tick marks inside of the
02:33parentheses for string literal.
02:34We are going type background-position outside of the first string literal, hit
02:44a comma, two more tick marks for a string literal, the value is going to be set to.
02:50Now we are going to type tick mark for string literal two + signs, another
02:55tick mark inside of the two plus signs we are going to come up here and copy new position.
03:02Let's come down here and paste this.
03:05So now we are going to concatenate the variable new position into the string
03:09literal which is going to be the value of the background-position +px space,
03:15and then we are going to type 0 px which is going to be the Y value which is
03:18always going to be set to 0.
03:20So now each time this animateThumbnail function runs we are to test the
03:24position, we are going to set a new position based on the window thumbnail
03:27times -1, and then we are going to set the background position equal to that on
03:32the X and 0 on the Y.
03:35Now we do have a hover class inside of here.
03:37We are going to set a hover class on the actual video link that we roll over,
03:41because we don't want all of the links to animate.
03:44We only want the one that were hovered over to animate.
03:47So that means we need to add one more item inside of the hover states.
03:50So if we go down into the a.videoLink into the hover class we are going to come
03:55down and after we set the img.play animation setting we are going to type
04:15(this).addClass('hover');.
04:17So now when we roll over the thumbnails not only are we going to set the caption
04:20in this position and set the animations, we are also going to add the hover
04:24class to the item we've rolled over.
04:26Let's copy this and when we roll out let's paste the addClass and change it to removeClass.
04:35Now let's hit File>Save, let's go over to our browser, let's hit Reload and now
04:41we will see that when we roll in each one of the items, the background graphics
04:44are going to change.
04:45They are going to change at the speed we are seeing the numbers change in the
04:48lower left-hand corner.
04:49So in addition to the play icons animating and the captions animating up, we
04:55also get the background graphics changing on each of the items that were rolled over.
05:04Now with that, that concludes the second option for creating the
05:06animated rollover states.
05:08In the next movie we will talk about where you might want to go from here with
05:10some of these techniques.
Collapse this transcript
Conclusion
Where to go from here
00:01Now that you have completed animated rollover course I want to talk about
00:04something that you might want to do to future projects.
00:06So, on the jQuery web site under docs. jquery.com, which is the same as the
00:10Documentation link here in the title bar.
00:12I want to scroll down on the left-hand side and come down and click on the Effects.
00:16the very first item under effects as the Animate command, which is what we used
00:20in our course that we just completed.
00:22Now there are whole bunch of CSS properties and animation properties you can
00:25set inside of jQuery and it will automatically take care of animating those different states.
00:31Now the other thing we added to our course was using a set interval in order
00:34to timeout animations.
00:36So there's a previous course I did for lynda.com called Adding an Autoplay to
00:40your Interactive Marquee.
00:41So here we have a timer that's in the lower left-hand corner, very similar again
00:45to what we did in this particular course and what we're doing here is actually
00:49animating the different states of this marquee based on that set timer interval.
00:53Now the other thing here that works the opposite of the animated thumbnails that
00:56we just created is when I roll my cursor inside of this object, we actually stop
01:00the animation so that the user can interact with this particular content.
01:04So, now setInterval can be a really powerful way to add some automated effects
01:08into your web site whether you are animating backgrounds of thumbnails or
01:11animating a marquee as we are doing here in order to keep the content fresh and
01:14updated if the user is not interacting with your content.
01:19So with that that concludes this course.
01:20I really appreciate you watching.
Collapse this transcript


Suggested courses to watch next:

Create an Interactive Map with jQuery (47m 38s)
Chris Converse


Set a Marquee to Autoplay with jQuery (36m 43s)
Chris Converse

jQuery Essential Training (4h 9m)
Joe Marini


Are you sure you want to delete this bookmark?

cancel

Bookmark this Tutorial

Name

Description

{0} characters left

Tags

Separate tags with a space. Use quotes around multi-word tags. Suggested Tags:
loading
cancel

bookmark this course

{0} characters left Separate tags with a space. Use quotes around multi-word tags. Suggested Tags:
loading

Error:

go to playlists »

Create new playlist

name:
description:
save cancel

You must be a lynda.com member to watch this video.

Every course in the lynda.com library contains free videos that let you assess the quality of our tutorials before you subscribe—just click on the blue links to watch them. Become a member to access all 98,695 instructional videos.

start free trial learn more

If you are already an active lynda.com member, please log in to access the lynda.com library.

Get access to all lynda.com videos

You are currently signed into your admin account, which doesn't let you view lynda.com videos. For full access to the lynda.com library, log in through iplogin.lynda.com, or sign in through your organization's portal. You may also request a user account by calling 1 1 (888) 335-9632 or emailing us at cs@lynda.com.

Get access to all lynda.com videos

You are currently signed into your admin account, which doesn't let you view lynda.com videos. For full access to the lynda.com library, log in through iplogin.lynda.com, or sign in through your organization's portal. You may also request a user account by calling 1 1 (888) 335-9632 or emailing us at cs@lynda.com.

Access to lynda.com videos

Your organization has a limited access membership to the lynda.com library that allows access to only a specific, limited selection of courses.

You don't have access to this video.

You're logged in as an account administrator, but your membership is not active.

Contact a Training Solutions Advisor at 1 (888) 335-9632.

How to access this video.

If this course is one of your five classes, then your class currently isn't in session.

If you want to watch this video and it is not part of your class, upgrade your membership for unlimited access to the full library of 1,899 courses anytime, anywhere.

learn more upgrade

You can always watch the free content included in every course.

Questions? Call Customer Service at 1 1 (888) 335-9632 or email cs@lynda.com.

You don't have access to this video.

You're logged in as an account administrator, but your membership is no longer active. You can still access reports and account information.

To reactivate your account, contact a Training Solutions Advisor at 1 1 (888) 335-9632.

Need help accessing this video?

You can't access this video from your master administrator account.

Call Customer Service at 1 1 (888) 335-9632 or email cs@lynda.com for help accessing this video.


site feedback

Thanks for signing up.

We’ll send you a confirmation email shortly.


By signing up, you’ll receive about four emails per month, including

We’ll only use your email address to send you these mailings.

Here’s our privacy policy with more details about how we handle your information.

Keep up with news, tips, and latest courses with emails from lynda.com.

By signing up, you’ll receive about four emails per month, including

We’ll only use your email address to send you these mailings.

Here’s our privacy policy with more details about how we handle your information.

   
submit Lightbox submit clicked