jQuery鼠标输出调用CSS3动画

jQuery mouse Out call CSS3 Animation

本文关键字:CSS3 动画 调用 输出 鼠标 jQuery      更新时间:2023-09-26

我目前有一个鼠标悬停事件的CSS3动画,请参阅下面的内容:

#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 */
    }
}

问题是:当用户将鼠标从按钮移开时,没有动画。在CSS中没有鼠标退出事件,那么,有没有一种方法可以像jQuery中那样调用鼠标退出的动画?

提前非常感谢。

你不能用jQuery来调用它吗?比如:

$('element').hover(function(e)
{
     $(this).css({"rollover animation css in here..."});
},function(e)
{
     $(this).css({"rolloff animation css in here..."});
});

或者甚至只有两个类".over"answers".out",然后使用$(this).addClass("over")&在滚落时也是这样?