Time for action – adding easing to effects

To use easing, all we need to do is include the easing function name as a configuration option. For example, to add easing to the blind.html example that we looked at earlier, we could change the JavaScript so that it appeared as follows:

$("#window").click(function() {
  $("#blind").toggle("blind", { easing: "easeOutBounce" });
});

What just happened?

We use the configuration option easing, with the name of the easing function as a string supplied as the value of the option. Any of the easing functions can be used by referencing their name in this way.

Get jQuery 1.4 Animation Techniques Beginner's Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.