Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

jQuery jQuery.speed method

jQuery jQuery.speed method

jQuery Miscellaneous MethodsjQuery Miscellaneous Methods


Definition and Usage

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

**Note:** 1. The $.speed() method provides a way to define properties such as duration, easing, and queue for a custom animation. With it, you do not have to implement the logic involved with default values and optional arguments 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. (One of three predefined speed strings ("slow", "normal", or "fast") or a number of milliseconds representing the animation duration (e.g., 1000))
settings PlainObject type
  • easing String type: A string indicating which easing function to use for the transition.
  • complete Function() type: A function called when the animation completes.
  • |

    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. (One of three predefined speed strings ("slow", "normal", or "fast") or a number of milliseconds 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 called when the animation completes, invoked once per matched element.

    Method 3

    $

    .speed( settings )

    Parameters Description
    settings PlainObject type
     
  • duration Number / String type: A string or number determining how long the animation will run.
  • easing String type: A string indicating which easing function to use for the transition.
  • complete Function() type: A function called when the animation completes.
  • |

    jQuery Miscellaneous MethodsjQuery Miscellaneous Methods