Check out this example: http://jsfiddle.net/nxsv5dgw/
A div appears on the stage and a CSS animation is applied to it. However, when attempting to use JQuery to animate the same properties that were animated by CSS, it seems to no longer work properly.
In the provided example, a CSS animation adjusts the width of a box. When clicking on the box, a JQuery animation is supposed to shrink both the width and height, but only the height changes. Here's the code snippet:
$(".a").click(function(e) {
$(this).animate({
width: "-=100px", // does not work after CSS animation
height: "-=100px",
}, 400);
})
.a {
background:red;
position:absolute;
height:500px;
width:600px;
animation: anim 0.4s forwards 1s;
}
@keyframes anim {
0% {width:600px;}
100% {width:500px;}
}
Is there a way to work around this issue? I would prefer to avoid performing all animations using JQuery if possible.