Skip to content

Instantly share code, notes, and snippets.

@nitriques
Last active August 29, 2015 14:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nitriques/3cba0eece75b896a7359 to your computer and use it in GitHub Desktop.
Save nitriques/3cba0eece75b896a7359 to your computer and use it in GitHub Desktop.
Polyfill jQuery animations with Velocity
// polyfill jQuery animation engine
$.fn.animate = $.fn.velocity;
$.fn.fadeTo = function (duration, opacity, complete) {
return this.velocity({opacity: opacity}, { duration: duration, complete: complete });
};
$.fn.fadeIn = function (duration, complete) {
return this.velocity('fadeIn', { duration: duration, complete: complete });
};
$.fn.fadeOut = function (duration, complete) {
return this.velocity('fadeOut', { duration: duration, complete: complete });
};
$.fn.slideUp = function (duration, complete) {
return this.velocity('slideUp', { duration: duration, complete: complete });
};
$.fn.slideDown = function (duration, complete) {
return this.velocity('slideDown', { duration: duration, complete: complete });
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment