02.06.2013 Views

jQuery 1.4 Animation Techniques - Index of

jQuery 1.4 Animation Techniques - Index of

jQuery 1.4 Animation Techniques - Index of

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

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

We also covered the following points:<br />

The fade methods work by altering the opacity and display properties <strong>of</strong> the<br />

selected elements. All methods may accept an optional duration argument in string<br />

or integer format except for the fadeTo() method, with which the argument is<br />

mandatory.<br />

Transparent PNGs in IE can end up with unsightly black borders when they are faded<br />

in or out with <strong>jQuery</strong>, but there are ways to avoid the issue in all current versions <strong>of</strong><br />

IE. We also saw that fading table elements can cause problems in IE.<br />

By default, the show(), hide(), and toggle() methods occur instantaneously.<br />

However, they can all be used to create animations by supplying a duration and/<br />

or easing argument(s).The duration argument may take integers representing<br />

milliseconds, or the strings slow or fast which correspond to durations <strong>of</strong> 600<br />

or 200 milliseconds.<br />

All animations have a default easing <strong>of</strong> swing, although we can change this to<br />

linear for an animation that proceeds at a uniform pace.<br />

CSS can have a huge impact on how animations proceed, as we saw when we looked<br />

at how to control the direction that the selected elements grow or shrink when<br />

using show() or hide().<br />

One thing to note with all <strong>of</strong> the fading animations is that it can cause issues with<br />

clearType text in IE; clearType is disabled when the animation runs so any text in the<br />

element being animated becomes aliased. There are several different work-arounds for this<br />

issue which involve removing the filter attribute once the animation has run.<br />

Now that we've covered the most basic types <strong>of</strong> <strong>jQuery</strong> animations and got an idea about<br />

how they run, we can move on to look at the animation queue and the methods we have at<br />

our disposal for managing it.<br />

[ 54 ]

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

Saved successfully!

Ooh no, something went wrong!