Created
November 14, 2014 22:54
-
-
Save kt3k/1b58726d2db46feb91a2 to your computer and use it in GitHub Desktop.
restartable css 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
$.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