jQuery jQuery.speedMethod

jQuery 杂项方法jQuery Miscellaneous Methods


Definition and Usage

The $.speed() function creates an object containing a set of properties to define custom animations.


Note:1. The $.speed() method provides a way to define properties such as duration, easing, and queue for custom animations. With it, you don't have to implement the logic involved with default values and optional parameters yourself.


Syntax

Method 1

$.speed( [duration ] [, settings ] )

Parameters Description
duration (default: 400) Number / String Type
A string or number determining how long the animation will run. (A string with one of three predetermined speeds ("slow", "normal", or "fast") or a millisecond value representing the animation duration (e.g., 1000))
settings PlainObject Type
  • easingString Type A string indicating which easing function to use for the transition.
  • completeFunction() Type A function to call once the animation is complete.

Method 2

$.speed( [duration ] [, easing ] [, complete ] )

Parameters Description
duration (default: 400) Number / String Type
A string or number determining how long the animation will run. (A string with one of three predetermined speeds ("slow", "normal", or "fast") or a millisecond value representing the animation duration (e.g., 1000))
easing String Type A string indicating which easing function to use for the transition.
complete Function() Type A function to call once the animation is complete, called once for each matched element.

Method 3

$.speed( settings )

Parameters Description
settings PlainObject Type
  • durationNumber / String Type A string or number determining how long the animation will run.
  • easingString Type A string indicating which easing function to use for the transition.
  • complete Function() Type A function to call once the animation is complete.


jQuery 杂项方法jQuery Miscellaneous Methods

Other Extensions