暂停CSS动画 [英] Pause css animation

查看:46
本文介绍了暂停CSS动画的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用html和css制作了幻灯片,当鼠标悬停在幻灯片上时,我想暂停幻灯片.我尝试使用 -webkit-animation-play-state:暂停; 来做到这一点,但这仅暂停了1张图像,因此将幻灯片弄乱了.有没有办法在悬停时暂停所有图像?

I made a slideshow in html and css and I want to pause the slideshow when my mouse goes over it. I tried to do this with -webkit-animation-play-state: paused;, but this only pauses 1 image and therefor messes up the slideshow. Is there a way to pause all the images on hover?

http://jsfiddle.net/m3q8pe56/

推荐答案

http://jsfiddle.net/m3q8pe56/1/

#slideshow:hover .photo {
    -webkit-animation-play-state: paused; 
    animation-play-state: paused; 
}

当您将鼠标悬停在 #slideshow 上时,您将暂停 #slideshow

When you hover #slideshow you will pause all .photo within #slideshow

这篇关于暂停CSS动画的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆