I have an animation on a couple of elements that last a few seconds. When you hover over one of them, I want the CSS3 animation to pause and do something, and when hover comes off, to continue animation.
Here is a quick example fiddle that shows the CSS3 animation happening, and when you hover over the third bar (with class .test) it should override the CSS:
@keyframes animation {
from { width: 0;}
to {width: 200px;}
}
@-webkit-keyframes animation {
from { width: 0;}
to {width: 100%;}
}
div {
animation: animation 3s;
-webkit-animation: animation 3s;
display:block;
height:50px;
background:red;
margin-bottom:20px;
}
.change {width: 50%;}
$('.test').hover( function() {
$(this).toggleClass('change');
});
Any ideas how to do this?