Skip to content

Instantly share code, notes, and snippets.

@sivagao
Created July 18, 2013 21:42
Show Gist options
  • Save sivagao/6033385 to your computer and use it in GitHub Desktop.
Save sivagao/6033385 to your computer and use it in GitHub Desktop.
use css3 animation|transition, instead of jQuery native time slice animation.
//= 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 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment