Created
September 5, 2012 20:12
-
-
Save jakebellacera/3643848 to your computer and use it in GitHub Desktop.
jQuery.css with jQuery.animate fallbacks. Useful for CSS3 animations.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //= require modernizr | |
| // Helper for performing css3 or jquery animations | |
| ;(function( window, $, undefined ){ | |
| 'use strict'; | |
| $.fn.css3animate = function (rules, duration, easing, callback) { | |
| var $this = $(this); | |
| if (Modernizr.csstransitions) { | |
| $this.css(rules); | |
| if (callback) { | |
| setTimeout(callback, duration); | |
| } | |
| } else { | |
| $this.animate(rules,duration,easing,callback); | |
| } | |
| return $this; | |
| } | |
| })( window, jQuery ); |
Author
Honestly, this could be way better. Instead of requiring you to set the timing duration in CSS, you could set the timing duration on the elements itself. I just put it up to scratch a specific itch. Feel free to fork if you'd like ;)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
O_O this is exactly what I wanted to make ... you were just a bit faster ... just 8 months :D