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.

[ 35 ]<br />

Chapter 2<br />

The CSS is used mostly to lay out the example page, and to give the elements their<br />

required sizing and background images. The most important rule is setting the help text to<br />

display:none, although this isn't actually critical like when using the fadeIn() method<br />

as the fadeToggle() method will work on both visible and hidden elements.<br />

In the script we simply call the fadeToggle() method on the second each time the<br />

first is clicked. The page will alternately show and hide the help text on each click <strong>of</strong><br />

the help icon.<br />

With this method, the natural display style <strong>of</strong> elements is not maintained. When our<br />

helpText is shown, it will have its display set to block, as opposed to a <br />

element's natural display type inline. In this example, this actually helps us—if the<br />

were set to its natural inline display, our widths and padding would not work<br />

correctly. But it is something we need to be aware <strong>of</strong> when using the method.<br />

Here's how the page should look after clicking the icon the first time:

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

Saved successfully!

Ooh no, something went wrong!