Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel is required to process package imports. If you need a different preprocessor remove all packages first.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Behavior

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.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <p>Click anywhere outside the featured element to advance to the next one.<br/>Scroll to advance or retreat cards.</p>
<div class="container">
  <div class="card">
    <img src="http://placehold.it/600x600/e4bd65/000000/?text=Card 1">
  </div>
   <div class="card">
    <img src="http://placehold.it/600x600/4c2c85/ffffff/?text=Card 2">
  </div>
   <div class="card">
    <img src="http://placehold.it/600x600/0efda2/000000/?text=Card 3">
  </div>
   <div class="card">
    <img src="http://placehold.it/600x600/900d16/ffffff/?text=Card 4">
  </div>
   <div class="card">
    <img src="http://placehold.it/600x600/7ed660/000000/?text=Card 5">
  </div>
   <div class="card">
    <img src="http://placehold.it/600x600/f4d4d8/000000/?text=Card 6">
  </div>
   <div class="card">
    <img src="http://placehold.it/600x600/0a3169/ffffff/?text=Card 7">
  </div>
   <div class="card">
    <img src="http://placehold.it/600x600/f0d102/000000/?text=Card 8">
  </div>
   <div class="card">
    <img src="http://placehold.it/600x600/42aea4/ffffff/?text=Card 9">
  </div>
   <div class="card">
    <img src="http://placehold.it/600x600/a79b66/000000/?text=Card 10">
  </div>
   <div class="card">
    <img src="http://placehold.it/600x600/7ed660/000000/?text=Card 11">
  </div>
   <div class="card">
    <img src="http://placehold.it/600x600/4c2c85/000000/?text=Card 12">
  </div>
   <div class="card">
    <img src="http://placehold.it/600x600/fa9413/000000/?text=Card 13">
  </div>
   <div class="card">
    <img src="http://placehold.it/600x600/3245b8/ffffff/?text=Card 14">
  </div>
   <div class="card">
    <img src="http://placehold.it/600x600/7cbe7d/ffffff/?text=Card 15">
  </div>
   <div class="card">
    <img src="http://placehold.it/600x600/000000/ffffff/?text=Card 16">
  </div>
   <div class="card">
    <img src="http://placehold.it/600x600/09cdd3/ffffff/?text=Card 17">
  </div>
   <div class="card">
    <img src="http://placehold.it/600x600/7b489f/000000/?text=Card 18">
  </div>
   <div class="card">
    <img src="http://placehold.it/600x600/51f55a/000000/?text=Card 19">
  </div>
   <div class="card">
    <img src="http://placehold.it/600x600/333333/cccccc/?text=Card 20">
  </div>
</div>
              
            
!

CSS

              
                body{margin: 0;}
p {
  width: 420px;
  font-size: 26px;
  line-height: 42px;
  position: absolute;
  left: 5vw;
  text-align: center;
}
.container {
  width: 60%;
  margin: 20px auto;
  position: relative;
}
.container .card {
	position: absolute;
	top: 0;
	left: 0;
	width: 420px;
	height: 420px;
  z-index: 12;
  transition: 1s ease;
}
.container .card img {
  width: 100%;
  height: auto;
}
.container .card:nth-child(1) {
	left: -200vw;
	z-index: 13;
	-webkit-transform: scale(1.125);
	        transform: scale(1.125);
	opacity: 0;
	-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";
}
.container .card:nth-child(2) {	
	left: 12vw;
	-webkit-transform: scale(1);
	        transform: scale(1);
	opacity: 1;
	-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)";
}
.container .card:nth-child(3) {
	left: 35vw;
	z-index: 11;
	-webkit-transform: scale(.875);
	        transform: scale(.875);
	opacity: .9;
	-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=90)";
}
.container .card:nth-child(4) {
	left: 40vw;
	z-index: 10;
	-webkit-transform: scale(.75);
	        transform: scale(.75);
	opacity: .8;
	-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=80)";
}
.container .card:nth-child(5) {
	left: 45vw;
	z-index: 9;
	-webkit-transform: scale(.625);
	        transform: scale(.625);
	opacity: .7;
	-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=70)";
}
.container .card:nth-child(6) {
	left: 50vw;
	z-index: 8;	
	-webkit-transform: scale(.5);	
	        transform: scale(.5);
	opacity: .6;
	-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=60)";
}
.container .card:nth-child(7) {
	left: 54vw;
	z-index: 7;	
	-webkit-transform: scale(.375);	
	        transform: scale(.375);
	opacity: .5;
	-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=50)";
}
.container .card:nth-child(8) {
	left: 57.75vw;
	z-index: 6;	
	-webkit-transform: scale(.25);	
	        transform: scale(.25);
	opacity: .4;
	-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=40)";
}
.container .card:nth-child(9) {
	left: 61vw;
	z-index: 5;	
	-webkit-transform: scale(.125);	
	        transform: scale(.125);
	opacity: .3;
	-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=30)";
}
.container .card:nth-child(10) {
	left: 62.5vw;
	z-index: 4;	
	-webkit-transform: scale(.05);	
	        transform: scale(.05);
	opacity: .2;
	-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=20)";
}
.container .card:nth-child(n+11) {
	display: none;
}
              
            
!

JS

              
                $(document).ready(function(){
  $('.card:last-child').prependTo($('.container')); // Move last child to first position
  $(window).bind('mousewheel', function(event) {
    if (event.originalEvent.wheelDelta >= 0) {
      retreatCard();
    } else {
      advanceCard();
    }
  });
  
		$(document).on('click', function(e) { 
			if(!$(e.target).closest('.card:nth-child(2)').length) {
				advanceCard();
			}        
		});
});
function advanceCard() {
	var firstCard = $('.card:first-child').detach();
	firstCard.appendTo($('.container'));
}
function retreatCard() {
	var lastCard = $('.card:last-child').detach();
	lastCard.prependTo($('.container'));
}
              
            
!
999px

Console