A Pen by Tobias Glaus on CodePen.
Created
June 30, 2017 19:37
-
-
Save teethnclaws/6ac01a83076872554172c743aa5bd572 to your computer and use it in GitHub Desktop.
Unfolding card
This file contains hidden or 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="wrapper"> | |
<div class="left"> | |
<div class="front"> | |
<div class="sectionWrap"> | |
<h1>Title</h1> | |
<hr> | |
<p class="preview">Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum.</p> | |
<button class="openB"><p>read more...</p></button> | |
</div> | |
</div> | |
<div class="back"> | |
<div class="sectionWrap"> | |
<h1>Left</h1> | |
<hr> | |
<p>Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata</p> | |
</div> | |
</div> | |
</div> | |
<div class="middle"> | |
<div class="sectionWrap"> | |
<h1>Middle</h1> | |
<hr> | |
<p>Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata</p> | |
</div> | |
</div> | |
<div class="right"> | |
<div class="sectionWrap"> | |
<h1>Right</h1> | |
<hr> | |
<p>Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata</p> | |
</div> | |
<button class="closeB">✕</button> | |
</div> | |
<footer> | |
<a target="_blank" href="https://codepen.io/tobiasglaus/"> | |
<img src="https://cdn1.iconfinder.com/data/icons/simple-icons/256/codepen-256-black.png"> | |
<p>Check out my other pens</p> | |
</a> | |
</footer> | |
</div> |
This file contains hidden or 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
$(function(){ | |
$(".openB").click(function(){ | |
$(".left").addClass("open"); | |
setTimeout(function(){ | |
$(".right").addClass("open"); | |
}, 250); | |
setTimeout(function(){ | |
$(".back").addClass("open"); | |
}, 350); | |
}); | |
$(".closeB").click(function(){ | |
setTimeout(function(){ | |
$(".left").removeClass("open"); | |
}, 250); | |
$(".right").removeClass("open"); | |
setTimeout(function(){ | |
$(".back").removeClass("open"); | |
}, 600); | |
}); | |
}); |
This file contains hidden or 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
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script> |
This file contains hidden or 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
*{ | |
margin:0; | |
padding:0; | |
} | |
html, body{ | |
width:100%; | |
height:100%; | |
overflow:hidden; | |
background: rgba(17,126,104,1); | |
background: -moz-radial-gradient(center, ellipse cover, rgba(17,126,104,1) 0%, rgba(17,126,104,1) 25%, rgba(1,81,54,1) 100%); | |
background: -webkit-gradient(radial, center center, 0px, center center, 100%, color-stop(0%, rgba(17,126,104,1)), color-stop(25%, rgba(17,126,104,1)), color-stop(100%, rgba(1,81,54,1))); | |
background: -webkit-radial-gradient(center, ellipse cover, rgba(17,126,104,1) 0%, rgba(17,126,104,1) 25%, rgba(1,81,54,1) 100%); | |
background: -o-radial-gradient(center, ellipse cover, rgba(17,126,104,1) 0%, rgba(17,126,104,1) 25%, rgba(1,81,54,1) 100%); | |
background: -ms-radial-gradient(center, ellipse cover, rgba(17,126,104,1) 0%, rgba(17,126,104,1) 25%, rgba(1,81,54,1) 100%); | |
background: radial-gradient(ellipse at center, rgba(17,126,104,1) 0%, rgba(17,126,104,1) 25%, rgba(1,81,54,1) 100%); | |
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#117e68', endColorstr='#015136', GradientType=1 ); | |
} | |
.wrapper{ | |
box-sizing:border-box; | |
width:100%; | |
height:100%; | |
-webkit-perspective: 2000px; | |
padding:5%; | |
perspective: 2000px; | |
} | |
.left, .middle, .right{ | |
float:left; | |
position:relative; | |
height:100%; | |
background-color:#fff; | |
width:33%; | |
} | |
.left{ | |
transform-origin:100% 50%; | |
transform: rotateY(180deg); | |
transition:.7s ease-in-out; | |
z-index:20; | |
} | |
.left.open{ | |
transform-origin:100% 50%; | |
transform:rotateY(0deg); | |
transition:.7s ease-in-out; | |
} | |
.right{ | |
transform-origin:0% 50%; | |
transform:rotateY(-180deg); | |
transition:.7s ease-in-out; | |
} | |
.right.open{ | |
transform-origin:0% 50%; | |
transform:rotateY(0deg); | |
transition:.7s ease-in-out; | |
} | |
.front, .back{ | |
height:100%; | |
width:100%; | |
position:absolute; | |
top:0; | |
} | |
.front{ | |
transform:rotateY(180deg); | |
background-color:#fff; | |
z-index:5; | |
} | |
.back{ | |
background-color:#fff; | |
z-index:4; | |
backface-visibility:hidden; | |
-webkit-backface-visibility:hidden; | |
} | |
.back.open{ | |
z-index:10; | |
} | |
.openB{ | |
background-color:transparent; | |
border:2px solid rgba(0,0,0,0.5); | |
padding:5px; | |
position:absolute; | |
min-width:120px; | |
max-width:150px; | |
z-index:50; | |
bottom:30px; | |
font-weight:400; | |
font-size:1em; | |
opacity:.7; | |
transition:.2s ease-in-out; | |
cursor:pointer; | |
} | |
.openB:hover{ | |
background-color:rgba(0,0,0,1); | |
color:white; | |
transition:.2s ease-in-out; | |
} | |
.closeB{ | |
position:absolute; | |
border:none; | |
background-color:rgba(0,0,0,0.6); | |
color:white; | |
z-index:50; | |
width:50px; | |
font-size:1.5em; | |
cursor:pointer; | |
height:50px; | |
top:0; | |
right:0; | |
transition:.2s ease-in-out; | |
} | |
.closeB:hover{ | |
background-color:rgba(0,0,0,0.2); | |
transition:.2s ease-in-out; | |
} | |
.preview{ | |
max-height:100px; | |
overflow:hidden; | |
text-overflow: ellipsis; | |
content: ""; | |
position:relative; | |
display:block; | |
} | |
.preview:before { | |
content:''; | |
width:100%; | |
height:100%; | |
position:absolute; | |
left:0; | |
top:0; | |
background:linear-gradient(transparent, white); | |
} | |
.sectionWrap{ | |
height:100%; | |
width:100%; | |
padding:40px; | |
box-sizing:border-box; | |
overflow:hidden; | |
} | |
h1{ | |
font-family: 'Playfair Display', serif; | |
font-size:3em; | |
line-height:1; | |
color:#34495e; | |
} | |
p{ | |
font-family: 'Josefin Sans', sans-serif; | |
font-size:1.2em; | |
max-height:100px; | |
text-overflow: clip; | |
} | |
hr{ | |
border:3px solid #34495e; | |
width:30px; | |
margin:12px 0 8px 1px; | |
text-align:left; | |
} | |
footer{ | |
position:fixed; | |
bottom:0; | |
width:100%; | |
height:50px; | |
left:0; | |
box-sizing:border-box; | |
padding-right:30px; | |
} | |
footer img{ | |
height:50px; | |
filter:invert(100%); | |
float:left; | |
} | |
footer p{ | |
margin-top:13px; | |
} | |
footer a{ | |
color:#fff; | |
text-decoration:none; | |
display:inline-block; | |
width:250px; | |
float:right; | |
opacity:1; | |
transition:.2s ease-in-out; | |
} | |
footer a:hover{ | |
opacity:.6; | |
transition:.2s ease-in-out; | |
} |
This file contains hidden or 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
<link href="https://fonts.googleapis.com/css?family=Josefin+Sans:400,700|Playfair+Display:900" rel="stylesheet" /> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I love this effect of opening by unfolding.