总有人间一两风,填我十万八千梦

jQuery .speed 用法 手册 | 示例代码

jQuery开发手册 归档 186℃ 0评论

Description: Creates an object containing a set of properties ready to be used in the definition of custom animations.

  • version added: 1.0jQuery.speed( [duration ] [, settings ] )

    • duration (default: 400)
      Type: Number or String
      A string or number determining how long the animation will run.
    • settings
      Type: PlainObject
      • easing (default: swing)
        Type: String
        A string indicating which easing function to use for the transition.
      • complete
        Type: Function()
        A function to call once the animation is complete.
  • version added: 1.1jQuery.speed( [duration ] [, easing ] [, complete ] )

    • duration (default: 400)
      Type: Number or String
      A string or number determining how long the animation will run.
    • easing (default: swing)
      Type: String
      A string indicating which easing function to use for the transition.
    • complete
      Type: Function()
      A function to call once the animation is complete, called once per matched element.
  • version added: 1.1jQuery.speed( settings )

    • settings
      Type: PlainObject
      • duration (default: 400)
        Type: Number or String
        A string or number determining how long the animation will run.
      • easing (default: swing)
        Type: String
        A string indicating which easing function to use for the transition.
      • complete
        Type: 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.

转载请注明:悠然品鉴 » jQuery .speed 用法 手册 | 示例代码

喜欢 (0)or分享 (0)
发表我的评论
取消评论

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
Open Popup

致:那些天天发邮件购买网站的RZ们

  • 我只是博客不更新了,不代表我域名上没有其他服务在运行,PS:服务器2027年到期。
    况且,你们自己心里很清楚你们买域名是干嘛的!不要在垃圾邮件OK?
    随便测试一下你们的 mail/domain 信息,笑死~~ 但凡有一个正经的,我都会回复一下。