I am attempting to create an animation that runs on one image inside a div when I hover over another image within the same div. However, it is not working as expected. The animation only takes effect when I use #div:hover, but not when I use #image:hover.
http://jsfiddle.net/tvmfjpbc/#&togetherjs=99g0GlPB33
#test {
position: relative;
width: auto;
height: 600px;
Background: lightblue;
margin: auto;
}
#cat {
position: absolute;
left: 150px;
top: 0;
animation-name: cat;
animation-duration: 2s;
animation-delay: 0s;
animation-play-state: paused;
}
#banana:hover #cat {
animation-play-state: running;
}
@keyframes cat {
0% {
left: 150px;
}
100% {
left: 250px;
}
}
<div id="test">
<img id="banana" src="https://i.imgur.com/D9TI3VT.jpg">
<img id="cat" src="https://i.imgur.com/j8gJnFq.jpg">
</div>