在悬停时播放CSS动画,在悬停时暂停

Neo*_*Neo 10 css animation hover

我试着

  • 在悬停时播放动画.
  • 悬停时暂停动画(即不要回到第0帧).

是不是可以-webkit-animation-play-state: paused;在父div上使用?

查看此处示例,当您将鼠标悬停时,它会返回到第0帧.

我不想用JS.

Mik*_*keM 11

示例jsfiddle

#tech播放状态暂停时设置动画

#tech {
    -webkit-animation-play-state:paused;
    -webkit-animation: moveSlideshow 10s linear infinite;
}
Run Code Online (Sandbox Code Playgroud)

然后将播放状态更改为在悬停时运行

#tech:hover{
    -webkit-animation-play-state:running;
}
Run Code Online (Sandbox Code Playgroud)

  • 它在Chrome下无效.图像一直在移动. (8认同)