Skip to content

Instantly share code, notes, and snippets.

@kt3k
Created November 14, 2014 22:54
Show Gist options
  • Save kt3k/1b58726d2db46feb91a2 to your computer and use it in GitHub Desktop.
Save kt3k/1b58726d2db46feb91a2 to your computer and use it in GitHub Desktop.
restartable css animation
$.fn.animation = function (animation) {
this.css('-webkit-animation', '').reflow().css('-webkit-animation', animation);
return this;
};
$.fn.reflow = function () {
this[0].offsetWidth = this[0].offsetWidth;
return this;
};
$(function () {
$('#button').click(function () {
$('#mything').animation('anim 500ms');
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment