Added callback for jQuery extension (#601)
Added to the extension for JQuery, callback function.
This commit is contained in:
parent
ff6509420d
commit
3cbe9930c2
|
@ -123,10 +123,13 @@ You can also extend jQuery to add a function that does it all for you:
|
|||
|
||||
```javascript
|
||||
$.fn.extend({
|
||||
animateCss: function (animationName) {
|
||||
animateCss: function (animationName, callback) {
|
||||
var animationEnd = 'webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend';
|
||||
this.addClass('animated ' + animationName).one(animationEnd, function() {
|
||||
$(this).removeClass('animated ' + animationName);
|
||||
if (callback) {
|
||||
callback();
|
||||
}
|
||||
});
|
||||
return this;
|
||||
}
|
||||
|
@ -137,6 +140,10 @@ And use it like this:
|
|||
|
||||
```javascript
|
||||
$('#yourElement').animateCss('bounce');
|
||||
or
|
||||
$('#yourElement').animateCss('bounce', function () {
|
||||
// Do somthing after animation
|
||||
});
|
||||
```
|
||||
|
||||
You can change the duration of your animations, add a delay or change the number of times that it plays:
|
||||
|
|
Loading…
Reference in New Issue