File size: 2,196 Bytes
2409829 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 |
.image-comparison {
position: relative;
touch-action: pan-y pinch-zoom;
max-width: Min(100%, 512px);
.crop-container {
height: 100%;
&:nth-child(2) {
overflow: hidden;
width: calc(100% - var(--comparison-percent));
&,
img {
position: absolute;
top: 0;
right: 0;
}
}
&.crop-container.crop-container {
img {
display: block;
width: auto;
height: 100%;
}
&:first-child img {
width: 100%;
}
}
}
.slide-bar {
position: absolute;
background: var(--color-navy);
margin-left: -2px;
width: 4px;
height: 100%;
top: 0;
left: var(--comparison-percent);
box-shadow: 0 0 2px rgba(255, 255, 255, 0.5);
.arrows {
position: absolute;
top: calc(50% - (40px / 2));
left: calc(4px / 2);
width: 0;
height: 0;
opacity: 1;
transition: opacity 0.25s;
svg {
position: absolute;
width: 6.5px;
height: 11px;
top: calc(-11px / 2);
fill: white;
@keyframes pulse-left {
from { transform: translateX(3px); }
to { transform: translateX(-3px); }
}
@keyframes pulse-right {
from { transform: scaleX(-1) translateX(3px); }
to { transform: scaleX(-1) translateX(-3px); }
}
@keyframes pulse-opacity {
0% { opacity: 0; }
40% { opacity: 1; }
90% { opacity: 1; }
100% { opacity: 0; }
}
&:nth-of-type(1) {
right: 6px;
animation: 3s infinite ease-out pulse-left, 3s infinite ease-out pulse-opacity;
}
&:nth-of-type(2) {
left: 6px;
animation: 3s infinite ease-out pulse-right, 3s infinite ease-out pulse-opacity;
}
}
div {
content: "";
position: absolute;
background: var(--color-navy);
top: 0;
left: 0;
width: 32px;
height: 32px;
transform: translate(-50%, -50%) rotate(45deg);
box-shadow: 0 0 2px rgba(255, 255, 255, 0.5);
}
// Cover up the box-shadow at the top and bottom of the circle so it connects to the vertical line
&::after {
content: "";
position: absolute;
background: var(--color-navy);
left: -2px;
top: -24px;
width: 4px;
height: 48px;
}
}
}
&:hover .slide-bar .arrows {
opacity: 0;
}
}
|