Reputation: 654
I Currently have a CSS3 animation for Mouse Hover Event, see it below:
#topo .menu-header ul li:hover a {
-webkit-animation: menuanimate 0.3s linear 0s both;
-moz-animation: menuanimate 0.3s linear 0s both;
-o-animation: menuanimate 0.3s linear 0s both;
-ms-animation: menuanimate 0.3s linear 0s both;
animation: menuanimate 0.3s linear 0s both;
}
@-webkit-keyframes menuanimate{
50% {
transform: rotateY(90deg);
-webkit-transform: rotateY(90deg); /* Safari and Chrome */
-moz-transform: rotateY(90deg); /* Firefox */
color: #353535;
background: url(images/bullets.png) no-repeat;
background-position: 3px 18px;
}
51% {
transform: rotateY(270deg);
-webkit-transform: rotateY(270deg); /* Safari and Chrome */
-moz-transform: rotateY(270deg); /* Firefox */
color: #fff;
background: #f15a25;
}
100% {
color: #fff; background: #f15a25;
transform: rotateY(360deg);
-webkit-transform: rotateY(360deg); /* Safari and Chrome */
-moz-transform: rotateY(360deg); /* Firefox */
}
}
The Problem is: When the user move the mouse away from the button, there is no Animation for that. in CSS there is no mouse out event, so, is there a way to call an animation of Mouse Out like that in jQuery?
Thanks a lot in advance.
Upvotes: 0
Views: 377
Reputation: 3790
Can't you just call it with jQuery like:
$('element').hover(function(e)
{
$(this).css({"rollover animation css in here..."});
},function(e)
{
$(this).css({"rolloff animation css in here..."});
});
or even just have 2 classes ".over" and ".out" and then use $(this).addClass("over") & same for out on rolloff?
Upvotes: 1