Is there a way to rollback an animation using only jQuery?
Imagine I have the following animations:
$("#myObject").animate({
/* animation 1 */
}).animate({
/* animation 2 */
}).animate({
/* animation 3 */
});
I was wondering if is there a way to animate #myObject
back on a reverse order w开发者_StackOverflow社区ith reverse attributes without writing it all over again.
I was thinking about making a css class and toggle it, but it won't have the animation steps. Also, css3 animations is not an option for this project.
Is it possible?
So, I thought this was a fun question, and I wrote this: http://jsfiddle.net/bstakes/hzFTg/#base
Its a very naive implementation, but it does what you are asking. So, yes there is a way to do it, but not out of the box.
精彩评论