jQuery 1.4 Animation Techniques - Index of

jQuery 1.4 Animation Techniques - Index of jQuery 1.4 Animation Techniques - Index of

02.06.2013 Views

[ 17 ] Chapter 1 c. A string or integer representing the speed or duration of the animation as the first argument, the ending opacity of the target element, and optionally a callback function to be executed when the animation ends d. No arguments are required Have a go hero – extending the loading animation I mentioned that we could use the loading animation when making requests and waiting for a response. Try using it with jQuery's AJAX methods, showing the loader just before making the request, and hiding it again once the response has been processed. The JSONP example, which retrieves images of cats, on the jQuery website (at http://api.jquery.com/ jQuery.getJSON/) makes a great test case, although depending on the speed of your connection, the loader may not be visible for very long. Summary In this introductory chapter, we looked at a brief history of animation on the Web including how it began, early HTML elements and browser support, the rise of Flash, and the direction it's heading in the not too distant future. We also looked at how animations can be used in a user interface to enhance the user experience. We saw some guidelines as to when animation should and shouldn't be used and looked at some of the things we should consider when implementing animations. We closed the chapter with a basic example looking at a loading animation. In this example, we used the fadeTo() jQuery method to change the opacity of elements on the page, and a simple interval to "play" the animation. We didn't cover the method in full detail, but we saw one example of how it can be used. We'll look at this method in more detail in the next chapter, which covers all of the fading animations provided by jQuery.

[ 17 ]<br />

Chapter 1<br />

c. A string or integer representing the speed or duration <strong>of</strong> the animation as<br />

the first argument, the ending opacity <strong>of</strong> the target element, and optionally<br />

a callback function to be executed when the animation ends<br />

d. No arguments are required<br />

Have a go hero – extending the loading animation<br />

I mentioned that we could use the loading animation when making requests and waiting for<br />

a response. Try using it with <strong>jQuery</strong>'s AJAX methods, showing the loader just before making<br />

the request, and hiding it again once the response has been processed. The JSONP example,<br />

which retrieves images <strong>of</strong> cats, on the <strong>jQuery</strong> website (at http://api.jquery.com/<br />

<strong>jQuery</strong>.getJSON/) makes a great test case, although depending on the speed <strong>of</strong> your<br />

connection, the loader may not be visible for very long.<br />

Summary<br />

In this introductory chapter, we looked at a brief history <strong>of</strong> animation on the Web including<br />

how it began, early HTML elements and browser support, the rise <strong>of</strong> Flash, and the direction<br />

it's heading in the not too distant future.<br />

We also looked at how animations can be used in a user interface to enhance the user<br />

experience. We saw some guidelines as to when animation should and shouldn't be used<br />

and looked at some <strong>of</strong> the things we should consider when implementing animations.<br />

We closed the chapter with a basic example looking at a loading animation. In this example,<br />

we used the fadeTo() <strong>jQuery</strong> method to change the opacity <strong>of</strong> elements on the page, and<br />

a simple interval to "play" the animation. We didn't cover the method in full detail, but we<br />

saw one example <strong>of</strong> how it can be used. We'll look at this method in more detail in the next<br />

chapter, which covers all <strong>of</strong> the fading animations provided by <strong>jQuery</strong>.

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

Saved successfully!

Ooh no, something went wrong!