cssAudio - ActiveCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - Activehtmlicon-personicon-teamoctocatspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

Quick-add: + add another resource

Code Indentation

     

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

            
              <div class="button"><img src="http://i68.tinypic.com/2nixjxw.png" alt="matryoshka"></div>
	<div class="modal">
		<div class="front"><img src="http://i68.tinypic.com/2nixjxw.png" alt="matryoshka"></div>
		<div class="back">
			<div class="content">
				<h1>Matryoshka</h1>
				<p>A Matryoshka nesting doll is a set of typically seven wooden dolls of decreasing sizes that all fit inside of each other, one by one. Each stacking doll splits in half at the mid section and opens to reveal another smaller doll nested within. The traditional Matryoshka doll is usually round in shape and decoratively painted to resemble a pretty young faced peasant woman dressed or bundled up in an extravagant sarafan costume, a loose fitting traditional Russian garment. </p>
			</div>
		</div>
		<div class="opened">
			<div class="content">
				<h1>Matryoshka</h1>
				<p>A Matryoshka nesting doll is a set of typically seven wooden dolls of decreasing sizes that all fit inside of each other, one by one. Each stacking doll splits in half at the mid section and opens to reveal another smaller doll nested within. The traditional Matryoshka doll is usually round in shape and decoratively painted to resemble a pretty young faced peasant woman dressed or bundled up in an extravagant sarafan costume, a loose fitting traditional Russian garment. </p>
			</div>
			<div class="close"></div>
		</div>
	</div>
	<div class="wrapper"></div>
            
          
!
            
              @import url(https://fonts.googleapis.com/css?family=Lato:300);

$bg-dark: #6f1634;
$bg-light: #ed739c;
$front-dark: #9bd151;
$front-light: #e2f0cb;
$shadow: #32314f;
$text: #5f5f5f;
$height: 265px;
$width: 530px;

@mixin radial-gradient($light, $dark) {
	background-image: -webkit-radial-gradient(circle, $light, $dark);
	background-image: -moz-radial-gradient(circle, $light, $dark);
	background-image: -ms-radial-gradient(circle, $light, $dark);
	background-image: radial-gradient(circle, $light, $dark);
}

*  {
  margin: 0;
  padding: 0;
}

html {
	height: 100%;
}

body {
	width: 100%;
	height: 100%;
	top: 0;
	left: 0;
	display: flex;
	position: fixed;
	overflow: auto;
	align-items: center;
	justify-content: center;
	@include radial-gradient($bg-light,$bg-dark);
	color: $text;
	font-family: 'Lato', sans-serif;
}

h1 {
	font-size: 30px;
	margin-bottom: 20px;
}

p {
	font-size: 15px;
}

.button {
	@include radial-gradient($front-light, $front-dark);
	width: $width / 2;
	height: $height;
	box-sizing: border-box;
	text-align: center;
	padding-top: 5px;
	cursor: pointer;
	box-shadow: 0 0 21px transparentize($shadow, .7);
	transition: all .4s;
	&:hover {
		box-shadow: 0 0 30px transparentize($shadow, .5);
	}
}

.modal {
	width: $width;
	height: $height;
	perspective: 2000px;
	z-index: 2;
	position: absolute;
	top: calc(#{50%} - #{$height / 2});
	left: calc(#{50%} - #{$width / 2});
	display: none;
}

.shadow {
	box-shadow: 0 0 30px transparentize($shadow, .5);
}

.wrapper {
	background: transparentize($shadow, .5);
	width: 100%;
	height: 100%;
	position: absolute;
	top: 0;
	left: 0;
	display: none;
}

.front,
.back,
.opened {
	height: $height;
	position: absolute;
	box-sizing: border-box;
}

.front {
	@include radial-gradient($front-light, $front-dark);
	width: $width / 2;
	text-align: center;
	padding-top: 5px;
	cursor: pointer;
	z-index: 3;
	backface-visibility: hidden;
	transform-origin: 0% 50%;
	box-shadow: 0 0 21px transparentize($shadow, .5);
	transform: rotateY(-180deg);
}

.back,
.opened {
	width: $width;
	padding: 35px 25px;
	clip: rect(auto, auto, auto, $width / 2);
}

.back {
	background: darken(white, 5%);	
	transform-origin: 50% 50%;
	transform: rotateY(-180deg);
	& .content {
		transform: rotateY(180deg);
	}
}

.opened {
	background: darken(white, 5%);
}

.close {
	position: absolute;
	top: 15px;
	right: 15px;
	cursor: pointer;
	width: 25px;
	height: 25px;
	background: url(http://i63.tinypic.com/1671taq.png) no-repeat center;
	background-size: cover;
	opacity: .6;
}

.front-open {
	animation: front 1.1s forwards ease-in-out;
}

.back-open {
	animation: back 1.1s forwards ease-in-out;
}

.opened-open {
	animation: opened 1.1s forwards ease-in-out;
}

.front-close {
	animation: front 1.1s forwards reverse ease-in-out;
}

.back-close {
	animation: back 1.1s forwards reverse ease-in-out;
}

.opened-close {
	animation: opened 1.1s forwards reverse ease-in-out;
}

@keyframes front {
	0% {
		transform: rotateY(0deg);
		left: $width / 4;
	}
	100% {
		transform: rotateY(-180deg);
		left: $width / 2;
	}
}

@keyframes back {
	0% {
		transform: rotateY(0deg);
		left: -$width / 4;
		background: darken(white, 70%);
	}
	100% {
		transform: rotateY(-180deg);
		left: 0;
		background: darken(white, 5%);
	}
}

@keyframes opened {
	0% {
		left: -$width / 4;
		background: darken(white, 35%);
	}
	100% {
		left: 0;
		background: darken(white, 5%);
	}
}
            
          
!
            
              $('.button').click(function() {
  $(this).hide();
	$('.front').addClass('front-open');
	$('.back').addClass('back-open');
	$('.opened').addClass('opened-open');
	$('.modal').show();
	setTimeout(function() {
		$('.modal').addClass('shadow');
	}, 1000);
	setTimeout(function() {
		$('.front').removeClass('front-open');
		$('.back').removeClass('back-open');
		$('.opened').removeClass('opened-open');
	}, 1200);
  $('.wrapper').delay(500).fadeIn();
});

$('.close').click(function() {
	$('.wrapper').fadeOut(300);
	$('.modal').removeClass('shadow');
	$('.front').addClass('front-close');
	$('.back').addClass('back-close');
	$('.opened').addClass('opened-close');
	setTimeout(function() {
		$('.modal').hide();
		$('.button').show();
		$('.front').removeClass('front-close');
		$('.back').removeClass('back-close');
		$('.opened').removeClass('opened-close');
	}, 1100)
})

$('.wrapper').click(function() {
	$('.wrapper').fadeOut(300);
	$('.modal').removeClass('shadow');
	$('.front').addClass('front-close');
	$('.back').addClass('back-close');
	$('.opened').addClass('opened-close');
	setTimeout(function() {
		$('.modal').hide();
		$('.button').show();
		$('.front').removeClass('front-close');
		$('.back').removeClass('back-close');
		$('.opened').removeClass('opened-close');
	}, 1100)
})
            
          
!
999px
Close

Asset uploading is a PRO feature.

As a PRO member, you can drag-and-drop upload files here to use as resources. Images, Libraries, JSON data... anything you want. You can even edit them anytime, like any other code on CodePen.

Go PRO

Loading ..................

Console