jQuery 1.4 Animation Techniques - Index of

jQuery 1.4 Animation Techniques - Index of jQuery 1.4 Animation Techniques - Index of

02.06.2013 Views

2. What else can be passed into the method? [ 27 ] Chapter 2 a. A string specifying the easing function to use for the animation, and a callback function to be executed once the animation ends b. An object containing additional configuration options c. An array containing additional configuration options d. A callback function to be executed at the start of an animation and a callback function to be executed at the end of the animation Have a go hero – doing more with fadeIn In this example, we used the fadeIn() method to show the hidden elements on mouseover, but hide the element straight away on mouseout. Have a go at extending the example so that the elements are faded out on mouseout instead of being hidden straight away using the fadeOut() method. Fading elements out The fadeOut() method is syntactically identical to fadeIn() in that it accepts the same arguments and adjusts the opacity of the selected element, except that with the fadeout() method, the target element is hidden instead of being shown. Let's look at this method in action with a brief example. When elements need to be removed from the page, using a subtle fade out can be much more effective than just removing the element in question. We may have an overlay of some description, like a dialog box for example, on the page which can be closed by the visitor. Instead of having it disappear instantly, we can animate its disappearance smoothly. In this example, we'll look at the following aspects of using fadeOut(): Hiding an element with the fadeOut() method Using a numerical argument to control the duration Running additional code once the animation completes

Fading Animations This is how our dialog will disappear from the page: In the previous screenshot, we see the dialog gradually fading from view once the has been clicked. The animation proceeds from top to bottom in the previous image. [ 28 ]

Fading <strong>Animation</strong>s<br />

This is how our dialog will disappear from the page:<br />

In the previous screenshot, we see the dialog gradually fading from view once the <br />

has been clicked. The animation proceeds from top to bottom in the previous image.<br />

[ 28 ]

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!