Hover/scss/hover/_hover-shadow.scss

73 lines
1.3 KiB
SCSS

/* Hover Shadow */
@keyframes hover {
50% {
transform: translateY(-3px);
}
100% {
transform: translateY(-6px);
}
}
@keyframes hover-shadow {
0% {
transform: translateY(6px);
opacity: .4;
}
50% {
transform: translateY(3px);
opacity: 1;
}
100% {
transform: translateY(6px);
opacity: .4;
}
}
@mixin hover-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(-6px);
animation-name: hover;
animation-duration: 1.5s;
animation-delay: $defaultDuration;
animation-timing-function: linear;
animation-iteration-count: infinite;
animation-direction: alternate;
&:before {
opacity: .4;
transform: translateY(6px);
animation-name: hover-shadow;
animation-duration: 1.5s;
animation-delay: .3s;
animation-timing-function: linear;
animation-iteration-count: infinite;
animation-direction: alternate;
}
}
}