I have an aeroplane and two propellers
I want to spin both propellers on hover, I can do it separately, but not together. Basically I want to hover one propeller (or the plane) and trigger the hover for the other propeller as well. Is this possible?
div.slide-right {
width:100%;
}
div.slide-right div.inner {
animation: slide-right 5s;
margin-left:18%;
}
@keyframes slide-right {
from {
margin-left: 0%;
}
to {
margin-left: 18%;
}
}
div.slide-right:hover img ??????????
So if I can trigger the hovers using the div.slide-right:hover what syntax is necessary?
a#rotator6 {
margin-left: 332px;
margin-top: 53px;
position: absolute;
}
a#rotator6 img {
-webkit-transition: all 0.5s ease-in-out;
-moz-transition: all 0.5s ease-in-out;
-o-transition: all 0.5s ease-in-out;
-ms-transition: all 0.5s ease-in-out;
border-radius: 60px;
transition-duration: 1s;
}
a#rotator6 img:hover {
-webkit-transform: rotate(1440deg);
-moz-transform: rotate(1440deg);
-o-transform: rotate(1440deg);
-ms-transform: rotate(1440deg);
transform: translate();
a#rotator5 {
margin-left: 507px;
margin-top: 53px;
position: absolute;
}
a#rotator5 img {
-webkit-transition: all 0.5s ease-in-out;
-moz-transition: all 0.5s ease-in-out;
-o-transition: all 0.5s ease-in-out;
-ms-transition: all 0.5s ease-in-out;
border-radius: 60px;
transition-duration: 1s;
}
a#rotator5 img:hover {
-webkit-transform: rotate(1440deg);
-moz-transform: rotate(1440deg);
-o-transform: rotate(1440deg);
-ms-transform: rotate(1440deg);
transform: translate();
}
<div class="slide-right">
<a id="rotator6"><img src="https://cdn.iconscout.com/icon/premium/png-256-thumb/propeller-screw-2848202-2368700.png" /></a>
<a id="rotator5"><img src="https://cdn.iconscout.com/icon/premium/png-256-thumb/propeller-screw-2848202-2368700.png" /></a>
</div>
2
Answers
If you’re okay with using some JavaScript, and a few changes to your HTML, here’s how you can do it:
You can either do this by applying
:hover
on a common parent element; so if stuff should rotate here, as soon as.slide-right
gets hovered anywhere, you could simply use that,.slide-right:hover img
– or wrap the two propellors into an additional element.If you don’t want that, then you could still use
:has()
to "check" if one of the images inside the parents is getting hovered.