I am trying to show a zoom effect and with an animation when I hover mouse over an image. I am using vue's class binding (which can be seen below after the problem definition). The problem is that I get the image zoomed with an animation but then the the zoom class gets called again and I see a zoomed image again if I don't move my mouse away from the image.
I have tried different animations but the same problem exists and transition also does not seem to work.
<v-avatar>
<img v-if="img" :src="img" :class="{ zoom: hover }" alt="" />
</v-avatar>
@keyframes change {
0% {
transform: scale(0) translateX(0px);
}
100% {
transform: scale(2.8) translateX(40px);
}
}
.zoom {
max-width: 100%;
height: auto;
border-radius: 10%;
box-shadow: 1px 1px 4px 0px rgba(0, 0, 0, 0.5);
animation: change 1s;
}
I expect to see the zoom behavior with an animation, but the zoom class should not be called again while the mouse is still over the avatar. So that would mean that I want the zoom effect to be shown only once, on a mouse hover.