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.

Pop quiz – fixing the flicker<br />

1. Why was it necessary to use a an anonymous function when calling the<br />

setTimeout() function in the previous example?<br />

a. It is the only format accepted by setTimeout()<br />

b. It executes faster<br />

c. In order to pass in an argument<br />

d. For fun<br />

Have a go hero – adding a delay before showing a submenu<br />

[ 99 ]<br />

Chapter 4<br />

Usability king Jakob Nielsen advises that a short-delay between the visitor hovering over a<br />

navigation menu item and the submenu being displayed, to ensure that the visitor actually<br />

wants to see the submenu, should be implemented in common interfaces. Not everyone<br />

will agree with this, and there is a danger <strong>of</strong> the menu feeling unresponsive if the delay is<br />

too long.<br />

Update the flickerFixed.html file so that there is a short delay before a submenu is<br />

shown after its parent menu item is hovered on.<br />

Summary<br />

The article which mentions the timing <strong>of</strong> displaying submenus can be found<br />

at http://www.useit.com/alertbox/mega-dropdown-menus.<br />

html.<br />

The sliding family <strong>of</strong> methods that we looked at over the course <strong>of</strong> the chapter are the last<br />

<strong>of</strong> <strong>jQuery</strong>'s built-in, predefined animation methods. The methods we looked at in this<br />

chapter were:<br />

slideDown()<br />

slideUp()<br />

slideToggle()<br />

We saw that these methods are very similar in how they are used to the other built-in <strong>jQuery</strong><br />

effect methods, allowing us to specify the same arguments. All that differs is the actual<br />

effect. The techniques we learned in this chapter included:<br />

Showing elements that are hidden using slideDown()<br />

Hiding visible elements with slideUp()<br />

Toggling the visibility <strong>of</strong> elements with slideToggle()

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

Saved successfully!

Ooh no, something went wrong!