Defining effect durations

Another property of the $.fx object is speeds. This property is an object itself, consisting of three properties, as evidenced by the jQuery core file:

speeds: {   slow: 600,   fast: 200,   // Default speed   _default: 400 } 

You've already learned that all of jQuery's animation methods provide an optional speed, or duration, argument. Looking at the $.fx.speeds object, we see that the strings slow and fast map up to 600 milliseconds and 200 milliseconds respectively. Each time an animation method is called, jQuery goes through the following steps to determine the duration of the effect, in this order:

  1. It checks if $.fx.off is true. If so, it sets the duration to 0.
  2. It checks if the duration passed is a number. If ...

Get Learning jQuery 3 - Fifth Edition 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.