-
-
Save liz282907/e04162ed10736bb54356d1867fb7c1b4 to your computer and use it in GitHub Desktop.
Interactive image comparison - with CSS resize
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
/** | |
* Interactive image comparison - with CSS resize | |
*/ | |
.image-slider { | |
position:relative; | |
display: inline-block; | |
} | |
.image-slider > div { | |
position: absolute; | |
top: 0; bottom: 0; left: 0; | |
width: 50%; | |
max-width: 100%; | |
overflow: hidden; | |
resize: horizontal; | |
} | |
.image-slider > div:before { | |
content: ''; | |
position: absolute; | |
right: 0; bottom: 0; | |
width: 12px; height: 12px; | |
padding: 5px; | |
} | |
.image-slider img { | |
display: block; | |
user-select: none; | |
} |
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
<div class="image-slider"> | |
<div><img src="http://csssecrets.io/images/adamcatlace-before.jpg" alt="Before" /></div> | |
<img src="http://csssecrets.io/images/adamcatlace.jpg" /> | |
</div> |
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
// alert('Hello world!'); |
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
{"view":"split-vertical","fontsize":"100","seethrough":"","prefixfree":"1","page":"css"} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment