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="container">
  <div class="image-area">
    <div class="overlay"></div>
    <div class="item first">
    </div>
    <div class="item second">
    </div>
    <div class="item third">
    </div>
  </div>
  <div class="dots"></div>
</div>
            
          
!
            
              .container {
	width: 400px;
	height: 300px;
	position: relative;
	margin: 50px auto;
	/*Set the perspective on the container*/
	-webkit-perspective: 800;
	perspective: 800;
}
.container .image-area {
	height: 300px;
	width: 400px;
	opacity: 1;
	/*Rotate the secondary container*/
	-webkit-transform-style: preserve-3d;
  transform-style: preserve-3d;
	-webkit-transform: rotateX(0deg);
	transform: rotateX(0deg);
	transition: all 1s ease;
}
.container .image-area.transition {
	opacity: 0.8;
}
.container .item {
	position: absolute;
	top: 0;
	left: 0;
  height: 300px;
	width: 400px;
  background-size: cover;
  background-position: center;
	-webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}
.container .item.first {
	-webkit-transform: rotateX(0deg) translateZ(150px);
	transform: rotateX(0deg) translateZ(150px);
  background-image: url('http://assets.worldwildlife.org/photos/2842/images/hero_small/shutterstock_12730534.jpg?1352150501');
}
.container .item.second {
	-webkit-transform: rotateX(-90deg) translateZ(150px);
  transform: rotateX(-90deg) translateZ(150px);
  background-image: url('http://blogs-images.forbes.com/juliewilcox/files/2012/10/fall-leaves-tree.jpg');
}
.container .item.third {
	-webkit-transform: rotateX(-180deg) translateZ(150px);
  transform: rotateX(-180deg) translateZ(150px);
  background-image: url('http://1.bp.blogspot.com/_RAlP3BmEW1Q/TQX5iLmaRxI/AAAAAAAACPo/rlWEYeLOY74/s1600/The-best-top-winter-desktop-wallpapers-7.jpg');
}
.dot {
	height: 20px;
	width: 20px;
	margin-top: 50px;
	margin-right: 1em;
	border-radius: 50%;
	background-color: black;
	display: inline-block;
	opacity: 0.5;
}
.dot:hover {
	cursor: pointer;
}
.dot.current {
	opacity: 1;
}
            
          
!
            
              $(function() {
	function createDots(cb) {
		var $slides = $('.image-area .item');
		var slideLength = $slides.length;
		var dotTemp = '<div class="dot"></div>';
		var html = '';
		var $dotContainer = $('.dots');
		for (var i = 0; i < slideLength; i++) {
			html += dotTemp;
		}
		$dotContainer.append(html);
		$dotContainer.find('.dot').eq(0).addClass('current');
		cb();
	}
	function rotateSlider() {
		var $container = $('.container .image-area');
		var $dot = $('.dots .dot');
		$dot.on('click', function() {
			var index = $dot.index($(this));
			$('.dots .dot').removeClass('current');
			$(this).addClass('current');
			$container.css('transform','rotateX(' + (index * 90) +'deg)');
			$container.addClass('transition');
			$container.on('transitionend', function() {
				$container.removeClass('transition');
			});
		});
	}
	createDots(function() {
		rotateSlider();
	});
});
            
          
!
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