jQuery.speed


jQuery.speed( [duration ] [, settings ] )Возвращает: PlainObject

Описание: Creates an object containing a set of properties ready to be used in the definition of custom animations.

  • Добавлен в версии: 1.0jQuery.speed( [duration ] [, settings ] )

    • duration (default: 400)
      Тип: Number or String
      A string or number determining how long the animation will run.
    • settings
      Тип: PlainObject
      • easing (default: swing)
        Тип: String
        A string indicating which easing function to use for the transition.
      • complete
        Тип: Function()
        A function to call once the animation is complete.
  • Добавлен в версии: 1.1jQuery.speed( [duration ] [, easing ] [, complete ] )

    • duration (default: 400)
      Тип: Number or String
      A string or number determining how long the animation will run.
    • easing (default: swing)
      Тип: String
      A string indicating which easing function to use for the transition.
    • complete
      Тип: Function()
      A function to call once the animation is complete, called once per matched element.
  • Добавлен в версии: 1.1jQuery.speed( settings )

    • settings
      Тип: PlainObject
      • duration (default: 400)
        Тип: Number or String
        A string or number determining how long the animation will run.
      • easing (default: swing)
        Тип: String
        A string indicating which easing function to use for the transition.
      • complete
        Тип: Function()
        A function to call once the animation is complete.

The $.speed() method provides a way to define properties, such as duration, easing, and queue, to use in a custom animation. By using it, you don't have to implement the logic that deals with default values and optional parameters.

This method is meant for plugin developers who are creating new animation methods. Letting $.speed() do all the parameter hockey and normalization for you, rather than duplicating the logic yourself, makes your work simpler. An example of use can be found in the animated form of .addClass() of jQuery UI.