Here's an example:
CSS
.intro-side3.out {
animation-name: out;
animation-duration: 2s;
}
.intro-side3.over {
animation-name: in;
animation-duration: 2s;
}
@-webkit-keyframes out {
0%{background-position:100% 49%}
100%{background-position:0% 52%}
}
@-webkit-keyframes in {
0%{background-position:0% 52%}
100%{background-position:100% 49%}
}
Javascript
$('.intro-side3').hover(
function() {
$(this).removeClass('out').addClass('over');
},
function() {
$(this).removeClass('over').addClass('out');
}
);
I am experimenting with a gradient animation on hover, and then reversing the animation when the mouse moves away. It works mostly fine, except that if you hover for more than the specified 2 seconds, the gradient goes back to its original state. I'm not sure why this is happening.
Maybe I am overlooking something obvious, right?