Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Replaces the standard jQuery timer loop with requestAnimationFrame where supported. Requires jQuery 1.8

License

NotificationsYou must be signed in to change notification settings

mmuchin/jquery-requestAnimationFrame

 
 

Repository files navigation

Replaces the standard jQuery timer loop withrequestAnimationFrame where supported.

Requires jQuery 1.8+

What isrequestAnimationFrame?

requestAnimationFrame is aworking draft spec that attempts to improve our animation performace by better syncing up with the frame rate of the browser. For more information, read this article onJank Busting

Why should I use it?

To quote part of the Jank Busting article:

  • Animations in background tabs get paused, conserving system resources and battery life.

  • If the system can't handle rendering at the screen's refresh rate, it can throttle animations and produce the callback less frequently (say, 30 times a second on a 60Hz screen). While this drops framerate in half, it keeps the animation consistent -- and as stated above, our eyes are much more attuned to variance than framerate. A steady 30Hz looks better than 60Hz that misses a few frames a second.

Download

Download theproduction version or thedevelopment version of version 0.1.1.

In your web page:

<scriptsrc="jquery.js"></script><scriptsrc="jquery.requestAnimationFrame.min.js"></script>

Documentation

There isn't anything you need to do other than include thejquery.requestAnimationFrame.js file to userequestAnimationFrame.

You should however beware of the first point above:Animations in background tabs get paused.

This means if you are using asetInterval orsetTimeout to queue up new animations, when the user returns to the backgrounded page, jQuery will finally see an animation finish, and then start playing everything queued. There is more information about potential workarounds injQuery Core Bug #9381

Contributing

In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code usinggrunt.

Also, please don't edit files in the "dist" subdirectory as they are generated via grunt. You'll find source code in the "src" subdirectory!

Release History

  • 0.1.1 - Mar 5 2013
    • Removedms prefix
  • 0.1.0 - Jan 13 2013
    • Initial Release

License

Copyright (c) 2012 Corey Frang
Licensed under the MIT license.

About

Replaces the standard jQuery timer loop with requestAnimationFrame where supported. Requires jQuery 1.8

Resources

License

Stars

Watchers

Forks

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp