Skip to content

Instantly share code, notes, and snippets.

@jkanclerz
Created April 5, 2014 23:47
Show Gist options
  • Select an option

  • Save jkanclerz/9999583 to your computer and use it in GitHub Desktop.

Select an option

Save jkanclerz/9999583 to your computer and use it in GitHub Desktop.
Form submit spinner
;(function ( $ ) {
'use strict';
$(document).ready(function() {
$('form').bind('submit', function() {
$(this).find('button[type="submit"] i').attr('class', 'glyphicon glyphicon-refresh animate');
});
});
})( jQuery );
<form>
<button type="submit">
Submit Form
<i></i>
</button>
</form>
.animate {
-animation: spin .7s infinite linear;
-webkit-animation: spin2 .7s infinite linear;
}
@-webkit-keyframes spin2 {
from { -webkit-transform: rotate(0deg);}
to { -webkit-transform: rotate(360deg);}
}
@keyframes spin {
from { transform: scale(1) rotate(0deg);}
to { transform: scale(1) rotate(360deg);}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment