css - fadeout on mouseout using keyframes? -
i'm using keyframes animation , i'm using markers when hover on them, information or picture appear. added fade-in, don't know how fade out.
have keyframes part:
@keyframes fadeout { 0% { opacity: 1;} 100% {opacity: 0;} } .fadeout { -webkit-animation-name: fadeout; animation-name: fadeout; }
and animation part (?) want insert:
animation-duration: 0.5s; animation-name: fadeout;
i guess problem don't know how insert it.
this codepen i'm using:
http://codepen.io/aslenwhitmore/pen/rxlygq?editors=0100
so can tell me should insert fadeout? thanks!
you can achieve desired effect using transition
property triggers opacity state on hover. there no need of javascript since css allows manipulate children of selector on hover or other states.
see codepen fork working example
since css cannot transition display
property, we'll use opacity , z-index
.
the z-index
hide elements under document (z-index:-1
) , bring them 999 once activated
hover code
&:hover .map-marker-info { opacity:1; z-index:999; }
static code
&-marker-info { display: block; transition:0.3s; opacity: 0; z-index: -1; }
p.s recommend increase radius of hover zone make points more user friendly
Comments
Post a Comment