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.

[ 71 ]<br />

Chapter 3<br />

Also note that the lower we set the interval property, the more intensive animations will<br />

be. While the latest browsers will cope with these increased demands satisfactorily, older or<br />

slower browsers will struggle.<br />

There must be no animations running when this property is set for it to take effect. Any<br />

animations that are running must be stopped.<br />

Summary<br />

While manipulating an element's fx queue directly may not <strong>of</strong>ten be required, when we<br />

do need to work with it, <strong>jQuery</strong> makes the process easy and transparent. With a collection<br />

<strong>of</strong> methods at our disposal, we can have full control over how the queue behaves. In this<br />

chapter, we looked at the following methods:<br />

clearQueue()<br />

delay()<br />

dequeue()<br />

queue()<br />

stop()<br />

We also looked at the following properties <strong>of</strong> the <strong>jQuery</strong> object:<br />

<strong>jQuery</strong>.fx.<strong>of</strong>f<br />

<strong>jQuery</strong>.fx.interval<br />

In this chapter we found that:<br />

The contents <strong>of</strong> the queue and the number <strong>of</strong> items in the queue can be easily<br />

obtained using the array that's returned by the queue() method. We can also<br />

use standard JavaScript array methods, such as push() or pop(), to interact<br />

with the array.<br />

We can supply different arguments to the queue() method which make adding<br />

a single function to the queue, or replacing the queue entirely, a trivial matter.<br />

When working with custom queues, or when adding more than a single new<br />

function to the default fx queue, we will need to ensure that the queue keeps<br />

running and executing the remaining functions. We can do this using either the<br />

dequeue() method, or a function passed into a callback function.<br />

The stop() method will halt the currently-running animation and can be made<br />

to clear the queue and force the element into its final state if necessary using<br />

additional arguments.<br />

The delay() method allows us to add an interval, or delay, in between<br />

queued animations.

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

Saved successfully!

Ooh no, something went wrong!