Hover/scss/hover/_float-shadow.scss

33 lines
791 B
SCSS

/* Float Shadow */
@mixin float-shadow {
display: inline-block;
position: relative;
transition-duration: $defaultDuration;
transition-property: transform;
@extend %hacks;
&:before {
pointer-events: none;
position: absolute;
z-index: -1;
content: '';
top: 100%;
left: 5%;
height: 10px;
width: 90%;
opacity: 0;
background: radial-gradient(ellipse at center, rgba(0,0,0,.35) 0%,rgba(0,0,0,0) 80%); /* W3C */
transition-duration: $defaultDuration;
transition-property: transform opacity;
}
&:hover {
transform: translateY(-5px); /* move the element up by 5px */
&:before {
opacity: 1;
transform: translateY(5px); /* move the element down by 5px (it will stay in place because it's attached to the element that also moves up 5px) */
}
}
}