From the course: jQuery for Web Designers
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Solution: Improve the animation - jQuery Tutorial
From the course: jQuery for Web Designers
Solution: Improve the animation
- [Voiceover] Okay, let's walk through my solution to the cart challenge. Let's see how it looks first. The items bounce over, fade out, shrink, when they're added to the cart, we get a little message. And they're ending up a little lower on the cart, targeting this 'Your items go here!' Okay, let's take a look at the code. So the first thing that we'll look at is the animation of the ghosted image. So I added an opacity of zero and then a width of 30 pixels. You could also specify this as simply a number. I chose to use 30 pixels to make it a little more explicit. And so we're going from the original opacity of one down to zero as the ghosted image moves over and it's shrinking down to 30 pixels. So it basically disappears. You could also of course go to a width of zero or whatever you like. I just happen to like the way it looked this way. Now let's look at the targeting. That's changed up here in the target coordinates. Before, we were just using the cart target. I still kept this…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.