diff options
| Commit | 8784804ed7aaa3ffc563c02499935cfbf3344848 (patch) | |
|---|---|---|
| Author | 2017-04-05 13:27:15 +0800 | |
| Committer | 2017-04-05 13:27:15 +0800 | |
| Files | 2ee411f6c0c81c12211ebe5cce3ed488e55d6be3 /src/comparison-sliders.less | |
| Spectre-Dark-Gruvbox-0.2.12.tar Spectre-Dark-Gruvbox-0.2.12.tar.gz Spectre-Dark-Gruvbox-0.2.12.zip | ||
| Parent | c4baa9b63a835edcbc1053e320bdec9902de0961 (diff) | |
| Parent | 9a7c233bd93d55bace2174651c42d9d26eeccd38 (diff) | |
Merge pull request #180 from picturepan2/feature/0.2.12 v0.2.12
Feature/0.2.12
1 files changed, 115 insertions, 0 deletions
| -rw-r--r-- | src/comparison-sliders.less | 115 |
diff --git a/src/comparison-sliders.less b/src/comparison-sliders.less new file mode 100644 index 0000000..5007f70 --- /dev/null +++ b/src/comparison-sliders.less @@ -0,0 +1,115 @@ +// Image comparison slider +// Credit: http://jsfiddle.net/os8bj2xq/ +.comparison-slider { + height: 50vh; + overflow: hidden; + position: relative; + width: 100%; + + .comparison-before, + .comparison-after { + height: 100%; + left: 0; + margin: 0; + overflow: hidden; + position: absolute; + top: 0; + + img { + height: 100%; + object-fit: none; + object-position: left top; + position: absolute; + width: 100%; + z-index: -1; + } + } + + .comparison-before { + width: 100%; + + .comparison-label { + right: 1.6rem; + } + } + + .comparison-after { + max-width: 100%; + min-width: 0; + z-index: @zindex-0; + + &::before { + background: transparent; + content: ""; + cursor: default; + height: 100%; + left: 0; + position: absolute; + right: 1.6rem; + top: 0; + z-index: @zindex-0; + } + + &::after { + background: currentColor; + border-radius: 50%; + box-shadow: 0 -.5rem, 0 .5rem; + color: @light-color; + content: ""; + height: .3rem; + position: absolute; + right: .8rem; + top: 50%; + transform: translate(50%, -50%); + width: .3rem; + z-index: -@zindex-0; + } + + .comparison-label { + left: 1.6rem; + } + } + + .comparison-resizer { + animation: first-run 1.5s 1 ease-in-out; + cursor: ew-resize; + height: 1.5rem; + left: 0; + max-width: 100%; + min-width: 1.6rem; + opacity: 0; + outline: none; + position: relative; + resize: horizontal; + top: 50%; + transform: translateY(-50%) scaleY(30); + width: 0; + } + + .comparison-label { + background: fade(@dark-color, 50%); + bottom: 1.6rem; + color: @light-color; + padding: .3rem .8rem; + position: absolute; + user-select: none; + } +} + +@keyframes first-run { + 0% { + width: 0; + } + 25% { + width: 4.8rem; + } + 50% { + width: 1.6rem; + } + 75% { + width: 2.4rem; + } + 100% { + width: 0; + } +} |