I have the following html
and css
I would like the effect hover
that I have inside the div
child to be able to be applied from anywhere in the div
parent and propagate from there, this is what I have:
.f {
width: 200px;
height: 200px;
background-color: grey;
position: fixed;
border-radius: 100px;
}
.s {
width: 50px;
height: 50px;
background-color: black;
border-radius: 100px;
margin: 75px 0px 0px 75px;
transition: width 1s, height 1s, margin 1s;
}
.s:hover {
width: 100px;
height: 100px;
background-color: black;
margin: 50px 0px 0px 50px;
}
<div class="f">
<div class="s"></div>
</div>
And more or less this is what I want:
PS: I know I'm not Picasso or a photoshop master XD
I leave you a solution with jquery, I have not been able to find a way to do it only with html and css
What you need to do is apply a handler to the
mouseover
parent's event so that you get the coordinates and can move the child before applying the transition. You don't need jQuery or any library, with pure and lightweight JavaScript you can do it in a few lines.Example