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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Sliding <strong>Animation</strong>s<br />

Have a go hero – using easing<br />

Try out some <strong>of</strong> the other easing methods that are available via the easing plugin in this,<br />

and some <strong>of</strong> our earlier examples. We'll be using easing where appropriate throughout the<br />

remainder <strong>of</strong> the book, but other than a cursory explanation these won't be focused on in<br />

any great detail.<br />

Pop quiz – using easing<br />

1. How many easing types does the easing plugin add?<br />

a. 20<br />

b. 30<br />

c. 17<br />

d. 48<br />

2. What can we pass into an effect method in the alternative format for using easing?<br />

a. An object with optional keys specifying the duration, easing type, and a<br />

function to call on complete<br />

b. A string specifying the easing type<br />

c. An array where the first item is the duration, the second is the easing type<br />

and the third is a function to call on complete<br />

d. An integer specifying the duration <strong>of</strong> easing<br />

The flicker effect<br />

Sometimes, using slideDown() and slideUp() animations on the same elements that<br />

are triggered when the visitor hovers over an element, such as with a navigation menu for<br />

example, can have an impact on the usability <strong>of</strong> a site. It's important to be aware <strong>of</strong> what the<br />

issue is and how it can be resolved.<br />

Time for action – avoiding the flicker effect<br />

Let's put together a couple <strong>of</strong> examples so that we can see which situations can cause the<br />

problem to arise.<br />

1. Open up the fadeIn.html file from Chapter 2, and update the element so<br />

that it appears as follows (new code shown in bold):<br />

<br />

<br />

[ 92 ]

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

Saved successfully!

Ooh no, something went wrong!