.item:hover {
zoom: 1;
filter: alpha(opacity=50);
opacity: 0.5;
-webkit-transition: opacity .15s ease-in-out;
-moz-transition: opacity .15s ease-in-out;
-ms-transition: opacity .15s ease-in-out;
-o-transition: opacity .15s ease-in-out;
transition: opacity .15s ease-in-out;
}
Why does this only animate the opacity when I hover-in but not when I leave the object with the mouse?
Demo here: https://jsfiddle.net/7uR8z/
You’re applying transitions only to the
:hoverpseudo-class, and not to the element itself.Demo: https://jsfiddle.net/7uR8z/6/
If you don’t want the transition to affect the
mouse-overevent, but onlymouse-out, you can turn transitions off for the:hoverstate :Demo: https://jsfiddle.net/7uR8z/3/