Default Animation Speed

Default Animation Speed
 点击下载

This is a very simple plugin that allows you to set the default animation duration for all jQuery animations. As of this writing, jQuery 1.2.1 uses a hard-coded value of 400 milliseconds, with no-built in way to set the default (although it is easy enough to get the default.) I needed to be able to set this default globally and on-the-fly for an internal company project, so I decided to do it "the right way" and release it in case anyone else has the same problem.

The plugin adds one function to the global jQuery object (it is not chainable.) It accepts a single parameter, which is any valid animation speed setting.

Calling the function without any parameters or with invalid value will set the animation speed back to the default. The function returns the default animation speed as an integer.

You call the function like this:

  1. $.setDefaultAnimationSpeed("slow"); 

 

转载请注明:代码家园 » Default Animation Speed

评论列表(网友评论仅供网友表达个人看法,并不表明本站同意其观点或证实其描述)