Book Image

Mastering jQuery

By : Alex Libby
Book Image

Mastering jQuery

By: Alex Libby

Overview of this book

<p>Mastering jQuery has been written not only to help maximize your skills with core functionality in the library, but also to explore some of the more intriguing ways of using the library to achieve real-world solutions that could feature on any website or online environment.</p> <p>You'll start with a look at some of the more advanced ways to incorporate the library into your pages, followed by working with forms and advanced form validation using regular expressions. Next you'll move on to animating in jQuery, advanced event handling, and using jQuery effects.</p> <p>Finally, you will develop practical examples of using jQuery with external functionality such as node-webkit, before finishing with a session on optimizing your version of the library for maximum efficiency and exploring best practices for using QUnit.</p>
Table of Contents (21 chapters)
Mastering jQuery
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Applying custom easing functions to effects


If someone mentions the word "easing" to you, I'll bet one of two things will happen:

  • You will most likely think that you'll need to use jQuery UI, which has the potential to add a fairly significant chunk of code to the page

  • You'll run away, at the thought of having to work out some horrendous math!

The irony here though, is that the answer to both could be yes and no (at least to the first part of the second comment). Hold on – how come?

The reason for this is that you most certainly don't need jQuery UI to provide special easing functions. Granted, if you are already using it, then it would make sense to use the effects contained within. While you might have to work out some maths, this would only be necessary if you really want to get stuck into complex formulae, which isn't always necessary. Intrigued? Let me explain more.

Adding an easing to code need not be any more than a simple function that uses any one of five different values, as shown in...