Latest web development tutorials

jQuery jQuery.speed method

jQuery Misc Methods jQuery Misc Methods


Definition and Usage

$ .speed () Function creates a property of the object is used to define a set of custom animation.


Note: 1. $ .speed () method provides a way to define attributes such as duration, easing, and queue, for custom animations. Use it, you do not have to implement the logical default values ​​and optional parameters involved.


grammar

method one

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

参数 描述
duration(默认:400) Number / String类型
一个字符串或数字决定动画将运行多久。(三种预定速度的字符串("slow", "normal", 或 "fast")或表示动画时长的毫秒数值(如:1000))
settings PlainObject类型
  • easing String类型 一个字符串,表示过渡使用哪种缓动函数。
  • complete Function()类型 动画完成时调用的函数。

Method Two

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

参数 描述
duration(默认:400) Number / String类型
一个字符串或数字决定动画将运行多久。(三种预定速度的字符串("slow", "normal", 或 "fast")或表示动画时长的毫秒数值(如:1000))
easing String类型 一个字符串,表示过渡使用哪种缓动函数。
complete Function()类型 动画完成时调用的函数,每个匹配元素上调用一次。

Method Three

$.speed( settings )

参数 描述
settings PlainObject类型
  • duration Number / String类型 一个字符串或数字决定动画将运行多久。
  • easing String类型 一个字符串,表示过渡使用哪种缓动函数。
  • complete Function()类型 动画完成时调用的函数。


jQuery Misc Methods jQuery Misc Methods