I am trying to run a CSS animation only when the mouse hovers over a certain element. Basically, if a mouse hovers over the parent element container, I want the child element light to run its animation only when it is hovered over. I would like to achieve this with JavaScript/jQuery since I am unsure if this is possible with just CSS alone. I am also new to JavaScript!
.light {
position: absolute;
transform: translate(-200%, 20%);
width: 4px;
height: 4px;
border-radius: 5px;
background: #0f0;
filter: hue-rotate(80deg);
z-index: 2;
animation: light 1s linear infinite;
}
@keyframes light {
*some animation*
}
<div class="container">
<div class="light"></div>
</div>
I am sorry if this is a basic question, but I've research for hours with no success!