by
Lessons:29Length:8 hours

3.5 Full Control With animate

Up until this lesson, we've been using jQuery's helper methods, such as fadeIn and slideDown(). However, behind the scenes, these all reference the animate() method.

Today, we'll review how to use it, and why it's necessary when you require full control over your animations.

Homework

Tonight, I want you to create your own fadeSlideToggle() method that will combine the functionality of slideToggle and fadeToggle. You may not reference either of these methods directly; instead, you'll use animate(). Hint: jQuery allows you to pass the string, "toggle," as a value for height and opacity.

When finished, the method should be called, like so: $('#box').fadeSlideToggle();. We'll write a solution together in the next lesson, but try to do it by yourself this evening.