File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -130,6 +130,25 @@ $('#yourElement').one('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimat
130130
131131** Note:** ` jQuery.one() ` is used when you want to execute the event handler at most * once* . More information [ here] ( http://api.jquery.com/one/ ) .
132132
133+ You can also extend jQuery to add a function that does it all for you:
134+
135+ ``` javascript
136+ $ .fn .extend ({
137+ animateCss : function (animationName ) {
138+ var animationEnd = ' webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend' ;
139+ $ (this ).addClass (' animated ' + animationName).one (animationEnd, function () {
140+ $ (this ).removeClass (' animated ' + animationName);
141+ });
142+ }
143+ });
144+ ```
145+
146+ And use it like this:
147+
148+ ``` javascript
149+ $ (' #yourElement' ).animateCss (' bounce' );
150+ ```
151+
133152You can change the duration of your animations, add a delay or change the number of times that it plays:
134153
135154``` css
You can’t perform that action at this time.
0 commit comments