-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #54 from Automattic/add/juxtapose-block
Add Image Compare Block
- Loading branch information
Showing
14 changed files
with
1,673 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,337 @@ | ||
/** | ||
* Juxtapose - v1.2.0 - 2017-12-18 | ||
* Copyright (c) 2017 Alex Duner and Northwestern University Knight Lab | ||
* | ||
* This code is governed by the terms of the Mozilla Public License (MPL) v2.0, | ||
* which is available here: https://github.com/NUKnightLab/juxtapose/blob/master/LICENSE | ||
* | ||
* This code is incorporated into Image Compare plugin, which is licensed under | ||
* GPLv2+, however you may use Juxtapose code separately under the terms of its | ||
* original MPL 2.0 license if you wish. | ||
*/ | ||
|
||
div.juxtapose { | ||
width: 100%; | ||
font-family: Helvetica, Arial, sans-serif; | ||
} | ||
|
||
div.jx-slider { | ||
width: 100%; | ||
height: 100%; | ||
position: relative; | ||
overflow: hidden; | ||
cursor: pointer; | ||
color: #f3f3f3; | ||
} | ||
|
||
div.jx-handle { | ||
position: absolute; | ||
height: 100%; | ||
width: 40px; | ||
cursor: col-resize; | ||
z-index: 15; | ||
margin-left: -20px; | ||
} | ||
|
||
.vertical div.jx-handle { | ||
height: 40px; | ||
width: 100%; | ||
cursor: row-resize; | ||
margin-top: -20px; | ||
margin-left: 0; | ||
} | ||
|
||
div.jx-control { | ||
height: 100%; | ||
margin-right: auto; | ||
margin-left: auto; | ||
width: 3px; | ||
background-color: currentColor; | ||
} | ||
|
||
.vertical div.jx-control { | ||
height: 3px; | ||
width: 100%; | ||
background-color: currentColor; | ||
position: relative; | ||
top: 50%; | ||
transform: translateY(-50%); | ||
} | ||
|
||
div.jx-controller { | ||
position: absolute; | ||
margin: auto; | ||
top: 0; | ||
bottom: 0; | ||
height: 60px; | ||
width: 9px; | ||
margin-left: -3px; | ||
background-color: currentColor; | ||
} | ||
|
||
.vertical div.jx-controller { | ||
height: 9px; | ||
width: 100px; | ||
margin-left: auto; | ||
margin-right: auto; | ||
top: -3px; | ||
position: relative; | ||
} | ||
|
||
div.jx-arrow { | ||
position: absolute; | ||
margin: auto; | ||
top: 0; | ||
bottom: 0; | ||
width: 0; | ||
height: 0; | ||
transition: all .2s ease; | ||
} | ||
|
||
.vertical div.jx-arrow { | ||
position: absolute; | ||
margin: 0 auto; | ||
left: 0; | ||
right: 0; | ||
width: 0; | ||
height: 0; | ||
transition: all .2s ease; | ||
} | ||
|
||
div.jx-arrow.jx-left { | ||
left: 2px; | ||
border-style: solid; | ||
border-width: 8px 8px 8px 0; | ||
border-color: transparent currentColor transparent transparent; | ||
} | ||
|
||
div.jx-arrow.jx-right { | ||
right: 2px; | ||
border-style: solid; | ||
border-width: 8px 0 8px 8px; | ||
border-color: transparent transparent transparent currentColor; | ||
} | ||
|
||
.vertical div.jx-arrow.jx-left { | ||
left: 0px; | ||
top: 2px; | ||
border-style: solid; | ||
border-width: 0px 8px 8px 8px; | ||
border-color: transparent transparent currentColor transparent; | ||
} | ||
|
||
.vertical div.jx-arrow.jx-right { | ||
right: 0px; | ||
top: auto; | ||
bottom: 2px; | ||
border-style: solid; | ||
border-width: 8px 8px 0 8px; | ||
border-color: currentColor transparent transparent transparent; | ||
} | ||
|
||
div.jx-handle:hover div.jx-arrow.jx-left, | ||
div.jx-handle:active div.jx-arrow.jx-left { | ||
left: -1px; | ||
} | ||
|
||
div.jx-handle:hover div.jx-arrow.jx-right, | ||
div.jx-handle:active div.jx-arrow.jx-right { | ||
right: -1px; | ||
} | ||
|
||
.vertical div.jx-handle:hover div.jx-arrow.jx-left, | ||
.vertical div.jx-handle:active div.jx-arrow.jx-left { | ||
left: 0px; | ||
top: 0px; | ||
} | ||
|
||
.vertical div.jx-handle:hover div.jx-arrow.jx-right, | ||
.vertical div.jx-handle:active div.jx-arrow.jx-right { | ||
right: 0px; | ||
bottom: 0px; | ||
} | ||
|
||
div.jx-image { | ||
position: absolute; | ||
height: 100%; | ||
display: inline-block; | ||
top: 0; | ||
overflow: hidden; | ||
-webkit-backface-visibility: hidden; | ||
} | ||
|
||
.vertical div.jx-image { | ||
width: 100%; | ||
left: 0; | ||
top: auto; | ||
} | ||
|
||
div.jx-image img { | ||
height: 100%; | ||
width: auto; | ||
z-index: 5; | ||
position: absolute; | ||
margin-bottom: 0; | ||
|
||
max-height: none; | ||
max-width: none; | ||
max-height: initial; | ||
max-width: initial; | ||
} | ||
|
||
.vertical div.jx-image img { | ||
height: auto; | ||
width: 100%; | ||
} | ||
|
||
div.jx-image.jx-left { | ||
left: 0; | ||
background-position: left; | ||
} | ||
|
||
div.jx-image.jx-left img { | ||
left: 0; | ||
} | ||
|
||
div.jx-image.jx-right { | ||
right: 0; | ||
background-position: right; | ||
} | ||
|
||
div.jx-image.jx-right img { | ||
right: 0; | ||
bottom: 0; | ||
} | ||
|
||
.veritcal div.jx-image.jx-left { | ||
top: 0; | ||
background-position: top; | ||
} | ||
|
||
.veritcal div.jx-image.jx-left img { | ||
top: 0; | ||
} | ||
|
||
.vertical div.jx-image.jx-right { | ||
bottom: 0; | ||
background-position: bottom; | ||
} | ||
|
||
.veritcal div.jx-image.jx-right img { | ||
bottom: 0; | ||
} | ||
|
||
div.jx-image div.jx-label { | ||
font-size: 1em; | ||
padding: .25em .75em; | ||
position: relative; | ||
display: inline-block; | ||
top: 0; | ||
background-color: #000; /* IE 8 */ | ||
background-color: rgba(0,0,0,.7); | ||
color: white; | ||
z-index: 10; | ||
white-space: nowrap; | ||
line-height: 18px; | ||
vertical-align: middle; | ||
} | ||
|
||
div.jx-image.jx-left div.jx-label { | ||
float: left; | ||
left: 0; | ||
} | ||
|
||
div.jx-image.jx-right div.jx-label { | ||
float: right; | ||
right: 0; | ||
} | ||
|
||
.vertical div.jx-image div.jx-label { | ||
display: table; | ||
position: absolute; | ||
} | ||
|
||
.vertical div.jx-image.jx-right div.jx-label { | ||
left: 0; | ||
bottom: 0; | ||
top: auto; | ||
} | ||
|
||
/* Animation */ | ||
div.jx-image.transition { | ||
transition: width .5s ease; | ||
} | ||
|
||
div.jx-handle.transition { | ||
transition: left .5s ease; | ||
} | ||
|
||
.vertical div.jx-image.transition { | ||
transition: height .5s ease; | ||
} | ||
|
||
.vertical div.jx-handle.transition { | ||
transition: top .5s ease; | ||
} | ||
|
||
/* keyboard accessibility */ | ||
div.jx-controller:focus, | ||
div.jx-image.jx-left div.jx-label:focus, | ||
div.jx-image.jx-right div.jx-label:focus, | ||
|
||
figcaption { | ||
text-align: center; | ||
font-size: 85%; | ||
} | ||
|
||
|
||
/** | ||
* Custom styling for handle. | ||
*/ | ||
|
||
div.jx-control { | ||
color: white; | ||
} | ||
|
||
div.jx-controller, | ||
.vertical div.jx-controller { | ||
width: 48px; | ||
height: 48px; | ||
border-radius: 50%; | ||
} | ||
|
||
div.jx-controller { | ||
margin-left: -22.5px; /* 48px / 2 - 3px separator width */ | ||
} | ||
|
||
.vertical div.jx-controller { | ||
/*top: -22.5px; */ | ||
transform: translateY(-19.5px); | ||
} | ||
|
||
div.jx-arrow.jx-left, | ||
div.jx-arrow.jx-right, | ||
.vertical div.jx-arrow.jx-left, | ||
.vertical div.jx-arrow.jx-right { | ||
width: 24px; | ||
height: 24px; | ||
border: none; | ||
background-repeat: no-repeat; | ||
z-index: 1; | ||
will-change: transform; | ||
} | ||
|
||
div.jx-arrow.jx-left { | ||
background-image: url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNCAyNCI+PHBhdGggZD0iTTEzLjQgMThMOCAxMmw1LjQtNiAxLjIgMS00LjYgNSA0LjYgNXoiLz48L3N2Zz4='); | ||
left: 0; | ||
} | ||
|
||
div.jx-arrow.jx-right { | ||
background-image: url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNCAyNCI+PHBhdGggZD0iTTEwLjYgNkw5LjQgN2w0LjYgNS00LjYgNSAxLjIgMSA1LjQtNnoiLz48L3N2Zz4='); | ||
right: 0; | ||
} | ||
|
||
div.vertical div.jx-arrow.jx-left, | ||
div.vertical div.jx-arrow.jx-right { | ||
transform: rotate(90deg); | ||
} |
Oops, something went wrong.