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