You could use the following to remove the class when the animation completes.
$(function () {
$('button').click(function () {
el = $('.element');
el.addClass('shake');
el.one('webkitAnimationEnd oanimationend msAnimationEnd animationend',
function (e) {
el.removeClass('shake');
});
});
});