Skip to content

Instantly share code, notes, and snippets.

@freshyill
Created July 18, 2012 01:59
Show Gist options
  • Save freshyill/3133606 to your computer and use it in GitHub Desktop.
Save freshyill/3133606 to your computer and use it in GitHub Desktop.
A web page created at CodePen.io
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>CodePen &middot; A Pen by freshyill</title>
<!--
Copyright (c) 2012 Chris Coleman, http://codepen.io/freshyill
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-->
<link rel="stylesheet" href="http://codepen.io/stylesheets/css/reset.css">
<style>
/* Variables */
.heading, .card-preview .text h1:first-child {
font-weight: bold;
}
html {
background: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(0%, #d2f0ff), color-stop(100%, #ffffff));
background: -webkit-linear-gradient(#d2f0ff 0%, #ffffff 100%);
background: -moz-linear-gradient(#d2f0ff 0%, #ffffff 100%);
background: -o-linear-gradient(#d2f0ff 0%, #ffffff 100%);
background: linear-gradient(#d2f0ff 0%, #ffffff 100%);
height: 100%;
}
body {
color: #222;
padding-top: 50px;
}
div[role="main"] {
width: 90%;
max-width: 200px;
margin: 0 auto;
height: 100%;
}
.cards-preview {
list-style: none;
}
.cards-preview li {
-webkit-perspective: 200px;
display: inline-block;
z-index: 1;
position: relative;
}
.card-preview {
position: relative;
z-index: 1;
background: #fff;
width: 150px;
height: 200px;
-webkit-box-shadow: 0 1px 0 black, 0 1px 10px black;
-moz-box-shadow: 0 1px 0 black, 0 1px 10px black;
box-shadow: 0 1px 0 black, 0 1px 10px black;
-webkit-transform-origin: 10px 50%;
-moz-transform-origin: 10px 50%;
-ms-transform-origin: 10px 50%;
-o-transform-origin: 10px 50%;
transform-origin: 10px 50%;
-webkit-transition: 0.5s all ease-in-out;
-webkit-transition-delay: 0.2s;
-moz-transition: 0.5s all ease-in-out 0.2s;
-o-transition: 0.5s all ease-in-out 0.2s;
transition: 0.5s all ease-in-out 0.2s;
-webkit-transform: scale(0.8) rotate(-2deg);
-moz-transform: scale(0.8) rotate(-2deg);
-ms-transform: scale(0.8) rotate(-2deg);
-o-transform: scale(0.8) rotate(-2deg);
transform: scale(0.8) rotate(-2deg);
-webkit-perspective: 800px;
-moz-perspective: 800px;
-ms-perspective: 800px;
-o-perspective: 800px;
perspective: 800px;
/*.cover-front {z-index: 3;}*/
}
.card-preview:hover {
-webkit-transform: scale(1) rotate(0deg);
-moz-transform: scale(1) rotate(0deg);
-ms-transform: scale(1) rotate(0deg);
-o-transform: scale(1) rotate(0deg);
transform: scale(1) rotate(0deg);
}
.card-preview .cover {
position: relative;
z-index: 2;
-webkit-transform-origin: left 50%;
-moz-transform-origin: left 50%;
-ms-transform-origin: left 50%;
-o-transform-origin: left 50%;
transform-origin: left 50%;
-webkit-transition: 1.2s all ease-in;
-webkit-transition-delay: 0s;
-moz-transition: 1.2s all ease-in 0s;
-o-transition: 1.2s all ease-in 0s;
transition: 1.2s all ease-in 0s;
}
.card-preview .cover.open {
-webkit-transform: rotateY(-150deg);
-moz-transform: rotateY(-150deg);
-ms-transform: rotateY(-150deg);
-o-transform: rotateY(-150deg);
transform: rotateY(-150deg);
}
.card-preview .cover-front,
.card-preview .cover-back {
position: relative;
display: block;
width: 150px;
height: 200px;
}
.card-preview .cover-back {
background-color: blue;
-webkit-transform: rotateY(180deg) translateX(-50px) translateY(-20px);
-moz-transform: rotateY(180deg) translateX(-50px) translateY(-20px);
-ms-transform: rotateY(180deg) translateX(-50px) translateY(-20px);
-o-transform: rotateY(180deg) translateX(-50px) translateY(-20px);
transform: rotateY(180deg) translateX(-50px) translateY(-20px);
}
.card-preview .cover-back {
display: block;
transform: rotateY(180deg);
box-sizing: border-box;
padding: 10px;
color: white;
text-align: center;
}
.card-preview .text {
position: absolute;
top: 0;
left: 0;
z-index: 1;
padding: 10px;
width: 100%;
height: 100%;
box-sizing: border-box;
}
.card-preview .text h1:first-child {
margin-top: 0;
font-size: 1.1em;
}
</style>
<style>
#codepen-footer, #codepen-footer * {
-webkit-box-sizing: border-box !important;
-moz-box-sizing: border-box !important;
box-sizing: border-box !important;
}
#codepen-footer {
display: block !important;
position: fixed !important;
bottom: 0 !important;
left: 0 !important;
width: 100% !important;
padding: 0 10px !important;
margin: 0 !important;
height: 30px !important;
line-height: 30px !important;
font-size: 12px !important;
color: #eeeeee !important;
background-color: #505050 !important;
text-align: left !important;
background: -webkit-linear-gradient(top, #505050, #383838) !important;
background: -moz-linear-gradient(top, #505050, #383838) !important;
background: -ms-linear-gradient(top, #505050, #383838) !important;
background: -o-linear-gradient(top, #505050, #383838) !important;
border-top: 1px solid black !important;
border-bottom: 1px solid black !important;
border-radius: 0 !important;
border-image: none !important;
box-shadow: inset 0 1px 0 #6e6e6e, 0 2px 2px rgba(0, 0, 0, 0.4) !important;
z-index: 300 !important;
font-family: "Lucida Grande", "Lucida Sans Unicode", Tahoma, sans-serif !important;
letter-spacing: 0 !important;
word-spacing: normal !important;
word-spacing: 0 !important;
-webkit-transform: none !important;
-moz-transform: none !important;
-ms-transform: none !important;
-o-transform: none !important;
transform: none !important;
}
#codepen-footer a {
color: #a7a7a7 !important;
text-decoration: none !important;
}
#codepen-footer a:hover {
color: white !important;
}
</style>
<script>
// Kill alerts, confirmations and prompts
window.alert = function(){};
window.confirm = function(){};
window.prompt = function(){};
window.open = function(){};
window.print = function(){};
</script>
</head>
<body>
<header>
</header>
<div role="main">
<div >
<ul class="cards-preview">
<li>
<article class="card-preview">
<section class="cover">
<img class="cover-front" src="http://i.imgur.com/eWxEa.jpg">
<div class="cover-back">asdfasdfsadf</div>
</section>
<section class="text">
<h1>Some stupid article</h1>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit.</p>
<a href="#">Read all about it</a>
</section>
</article>
</li>
</ul>
</div>
</div>
<footer>
</footer>
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script src="http://codepen.io/javascripts/libs/modernizr.js"></script>
<script>
(function() {
$('.card').click(function(e){
$(this).addClass('viewing');
});
$('.card-preview').hover(function(e){
$(this).find('.cover').toggleClass('open');
});
})();
</script>
<div id="codepen-footer">
<a style="color: #f73535 !important;" href="https://codepen.wufoo.com/forms/m7x3r3/def/field14=" onclick="window.open(this.href, null, 'height=517, width=680, toolbar=0, location=0, status=1, scrollbars=1, resizable=1'); return false">Report Abuse</a>
&nbsp;
<a href="/freshyill/pen/otdnC">Edit this Pen</a>
</div>
</body>
</html>
$('.card').click(function(e){
$(this).addClass('viewing');
});
$('.card-preview').hover(function(e){
$(this).find('.cover').toggleClass('open');
});
<header>
</header>
<div role="main">
<div >
<ul class="cards-preview">
<li>
<article class="card-preview">
<section class="cover">
<img class="cover-front" src="http://i.imgur.com/eWxEa.jpg">
<div class="cover-back">asdfasdfsadf</div>
</section>
<section class="text">
<h1>Some stupid article</h1>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit.</p>
<a href="#">Read all about it</a>
</section>
</article>
</li>
</ul>
</div>
</div>
<footer>
</footer>
@import "compass";
/* Variables */
$red: #f00;
.heading {font-weight: bold;}
html {@include background(linear-gradient(#d2f0ff 0%, #fff 100%)); height: 100%;}
body {color: #222; padding-top: 50px;}
div[role="main"] {width: 90%; max-width: 200px; margin: 0 auto; height: 100%;}
.cards-preview {
list-style: none;
li {-webkit-perspective: 200px; display: inline-block; z-index: 1; position: relative;}
}
.card-preview {
position: relative; z-index: 1;
background: #fff;
width: 150px; height: 200px;
@include box-shadow(0 1px 0 #000, 0 1px 10px #000);
@include transform-origin(10px);
@include transition(.5s all ease-in-out .2s);
@include transform(scale(.8) rotate(-2deg));
@include perspective(800px);
&:hover {
@include transform(scale(1) rotate(0deg));
//@include transition(.35s all ease-out 0);
}
.cover {
position: relative; z-index: 2;
@include transform-origin(left);
@include transition(1.2s all ease-in 0s);
&.open {@include transform(rotateY(-150deg));}
}
.cover-front,
.cover-back {position: relative; display: block; width: 150px; height:200px;}
/*.cover-front {z-index: 3;}*/
.cover-back { background-color: blue; @include transform(rotateY(180deg) translateX(-50px) translateY(-20px));}
.cover-front {
}
.cover-back {
display: block;
transform: rotateY(180deg);
box-sizing: border-box;
padding: 10px;
color: white;
text-align: center;
}
.text {
position: absolute; top: 0; left: 0; z-index: 1; padding: 10px; width: 100%; height: 100%; box-sizing: border-box;
h1:first-child {margin-top: 0; font-size: 1.1em; @extend .heading;}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment