CSS3 Animation + @keyframe run till the end

2019-07-30 01:01发布

I can't find the way to play an animation till the end when an element is :hover.

  • When i :hover out, the animation reset - but i want it to continue till the end.
  • JsFiddle
<div class="picture"></div>
    .picture:hover {
       -webkit-animation:swing 1s ease-in-out;
    }


    @-webkit-keyframes swing {
      [...] 
    }

3条回答
相关推荐>>
2楼-- · 2019-07-30 01:22

I did like this http://jsfiddle.net/Z5aq7/

Instead of Hovering, I just made it a class (.animate) and adding the class on hover

$('.picture').hover(function(){
    $(this).addClass('animate');
});

Hope this helps!

查看更多
SAY GOODBYE
3楼-- · 2019-07-30 01:27

Probably not a complete solution, but add the following to your picture class:

-webkit-animation:swing 3600ms ease-in-out 6000s;
-webkit-transform-origin:top;

JsFiddle: http://jsfiddle.net/5SueS/4/

查看更多
该账号已被封号
4楼-- · 2019-07-30 01:37

Seems that there is no pure css solutions, so best solution with JS:

Stackoverflow - animation on hover force entire animation

查看更多
登录 后发表回答