cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

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.

Quick-add: + add another resource

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.

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="view">
	<div class="card__full">
		<div class="card__full-top">
			<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
					<path d="M16.59 8.59l-4.59 4.58-4.59-4.58-1.41 1.41 6 6 6-6z"/>
					<path d="M0 0h24v24h-24z" fill="none"/>
			</svg>
			<span class="card__full-num"></span>
		</div>
		<div class="card__full-bottom">
			<p class="card__full-handle"></p>
			<p class="card__full-info"></p>
		</div>
	</div>
	<ul class="card__list">
		<li class="card__item card__item--blue">
			<div class="card__info">
				<div class="info-player">
					<p class="info-player__num">9</p>
					<p class="info-player__name"><small>Tony</small><br>Romo</p>
				</div>
				<div class="info-place">1<sup>st</sup></div>
			</div>
		</li>
		<li class="card__item card__item--purple">
			<div class="card__info">
				<div class="info-player">
					<p class="info-player__num">18</p>
					<p class="info-player__name"><small>Tom</small><br>Brady</p>
				</div>
				<div class="info-place">2<sup>nd</sup></div>
			</div>
		</li>
		<li class="card__item card__item--green">
			<div class="card__info">
				<div class="info-player">
					<p class="info-player__num">12</p>
					<p class="info-player__name"><small>Aaron</small><br>Rogers</p>
				</div>
				<div class="info-place">3<sup>rd</sup></div>
			</div>
		</li>
		<li class="card__item card__item--yellow">
			<div class="card__info">
				<div class="info-player">
					<p class="info-player__num">7</p>
					<p class="info-player__name"><small>Ben</small><br>Roethlisberger</p>
				</div>
				<div class="info-place">4<sup>th</sup></div>
			</div>
		</li>
		<li class="card__item card__item--tan">
			<div class="card__info">
				<div class="info-player">
					<p class="info-player__num">9</p>
					<p class="info-player__name"><small>Drew</small><br>Brees</p>
				</div>
				<div class="info-place">5<sup>th</sup></div>
			</div>
		</li>
		<li class="card__item card__item--orange">
			<div class="card__info">
				<div class="info-player">
					<p class="info-player__num">18</p>
					<p class="info-player__name"><small>Peyton</small><br>Manning</p>
				</div>
				<div class="info-place">6<sup>th</sup></div>
			</div>
		</li>
	</ul>
</div>

<a href="http://ettrics.com/code/mobile-material-design-cards/" class="logo" target="_blank">
 <img class="logo" src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/45226/ettrics-logo.svg" alt="" /> 
</a>
            
          
!
            
              $space: 1.5rem;
$grey: lighten(black, 25);
$blue: #5171C3;
$orange: #DE660F;
$green: #2EA83B;
$yellow: #BDB235;
$tan: #AA9E5C;
$purple: #3E5EB3;
$ease: all .5s cubic-bezier(0.23, 1, 0.32, 1);

@function longshadow($color_a,$color_b,$stepnum, $opacity: 1) {
	$gradient_steps: null;
	@for $i from 1 through $stepnum {
		$weight: ( ( $i - 1 ) / $stepnum ) * 100;
		$colour_mix: mix($color_b, rgba($color_a, $opacity), $weight);
		$seperator: null;
		@if($i != $stepnum){ 
			$seperator: #{','}; 
		}
		$gradient_steps: append( #{$gradient_steps}, #{$i}px #{$i}px $colour_mix $seperator );
 }
  @return $gradient_steps;
}

* {
	box-sizing: border-box
}

ul {
	margin: 0;
	padding: 0;
	list-style-type: none;
}

body {
	display: flex;
	align-items: center;
	justify-content: center;
	height: 100vh;
	line-height: 1.5;
	font-family: 'Montserrat';
	background: darken(white, 5);
	color: $grey;
	overflow: hidden;
}

.view {
	position: relative;
	height: 640px;
	width: 384px;
	background: darken(white, 1);
	box-shadow: 0 3px 6px rgba(black,0.16), 0 3px 6px rgba(black,0.23);
	overflow-y: scroll;
}

.card {
	
	&__list {
		padding: $space / 2;
	}
	
	&__item {
		margin: 0 0 $space / 2;
		padding: $space*1.5 $space;
		border-top: 4px solid $grey;
		box-shadow: 0 1px 3px rgba(black,.12), 0 1px 2px rgba(black,0.24);
		background: white;
		cursor: pointer;
		transition: $ease;
		
		&--blue {
			border-top-color: $blue;
			p.info-player__num { 
				background: $blue;
				text-shadow: longshadow(darken($blue, 15%),$blue,20, 0.7);
			}
			&:hover {
				.info-player__name,
				.info-place {
					color: $blue;
				}
			}
		}
		
		&--orange {
			border-top-color: $orange;
			p.info-player__num { 
				background: $orange;
				text-shadow: longshadow(darken($orange, 15%),$orange,20, 0.7);
			}
			&:hover {
				.info-player__name,
				.info-place {
					color: $orange;
				}
			}
		}
		
		&--green {
			border-top-color: $green;
			p.info-player__num { 
				background: $green;
				text-shadow: longshadow(darken($green, 15%),$green,20, 0.7);
			}
			&:hover {
				.info-player__name,
				.info-place {
					color: $green;
				}
			}
		}
		
		&--yellow {
			border-top-color: $yellow;
			p.info-player__num { 
				background: $yellow;
				text-shadow: longshadow(darken($yellow, 15%),$yellow,20, 0.7);
			}
			&:hover {
				.info-player__name,
				.info-place {
					color: $yellow;
				}
			}
		}
		
		&--tan {
			border-top-color: $tan;
			p.info-player__num { 
				background: $tan;
				text-shadow: longshadow(darken($tan, 15%),$tan,20, 0.7);
			}
			&:hover {
				.info-player__name,
				.info-place {
					color: $tan;
				}
			}
		}
		
		&--purple {
			border-top-color: $purple;
			p.info-player__num { 
				background: $purple;
				text-shadow: longshadow(darken($purple, 15%),$purple,20, 0.7);
			}
			&:hover {
				.info-player__name,
				.info-place {
					color: $purple;
				}
			}
		}
		
		&:hover {
			background: #444;
			
			.info-player__num {
				transform: scale(1.1);
			}
		}
	}
	
	&__info {
		display: flex;
		align-items: center;
		justify-content: space-between;
		
		.info-player {
			display: flex;
			align-items: center;
			
			&__num {
				width: 60px;
				height: 60px;
				line-height: 36px;
				padding: $space / 2;
				margin: 0 $space / 2 0 0;
				text-align: center;
				background: silver;
				border-radius: 50%;
				font-size: 36px;
				color: white;
				overflow: hidden;
				transition: $ease;
			}
			
			&__name {
				line-height: 1.1;
				font-size: 20px;
				margin: 0;
				
				small {
					font-size: 14px;
				}
			}
		}
		
		.info-place {
			margin: 0;
			font-size: 24px;
		}
	}
	
	&__full {
		will-change: transform;
		display: flex;
		flex-flow: column wrap;
		position: fixed;
		top: 50%;
		left: 50%;
		width: 384px;
		height: 640px;
		z-index: 2;
		visibility: hidden;
		transform-origin: top center;
		transform: scaleY(0) translate(-50%, -50%);
		transition: $ease;
		
		&.active {
			visibility: visible;
			transform: scaleY(1) translate(-50%, -50%);
			
			.card__full-num,
			.card__full-handle,
			.card__full-info {
				opacity: 1;
			}
		}
		
		&-top, 
		&-bottom {
			flex: 1;
		}
		
		&-bottom {
			display: flex;
			justify-content: center;
			flex-flow: column wrap;
			padding: 0 $space * 2;
			background: white;
		}
		
		&-top {
			position: relative;
			display: flex;
			align-items: center;
			justify-content: center;
			background: $blue;
			overflow: hidden;
			
			svg {
				position: absolute;
				top: $space;
				left: $space;
				fill: rgba(black, 0.4);
				width: 32px;
				cursor: pointer;
				transition: $ease;
				
				&:hover {
					fill: rgba(black, 0.7);
				}
			}
		}
		
		&-num,
		&-handle,
		&-info {
			opacity: 0;
			transition: $ease;
			transition-duration: 2s;
			transition-delay: .35s;
		}
		
		&-num {
			color: white;
			font-size: 140px;
		}
		
		&-handle {
			font-size: 16px;
			margin: 0;
		}
		
		&-info {
			margin: 0;
			font-size: 20px;
			color: $grey;
		}
	}
}

.logo {
  position: fixed;
  bottom: 3vh;
  right: 3vw;
  z-index: 2;
  
  
  img {
    width: 45px;
    transition: $ease;
    transform: rotate(0);
		filter: invert(100%);
		-webkit-filter: invert(100%);
  
    &:hover {
      transform: rotate(180deg) scale(1.1);
    }
  }
}
            
          
!
            
              var Cards = (function() {
	
	var view 	= $('.view');
	var vw 		= view.innerWidth();
	var vh	 	= view.innerHeight();
	var vo 		= view.offset();
	var card 	= $('.card__item');
	var cardfull = $('.card__full');
	var cardfulltop = cardfull.find('.card__full-top');
	var arrow = cardfulltop.find('svg');
	var cardnum = cardfulltop.find('.card__full-num');
	var cardhandle = cardfull.find('.card__full-handle');
	var cardinfo = cardfull.find('.card__full-info');
	var w 		= $(window);
	
	var data = [
		{
			num: 9,
			handle: '@tonyromo',
			info: 'This is some info about the player and sports.'
		},
		{
			num: 18,
			handle: '@tombrady',
			info: 'This is some info about the player and sports.'
		},
		{
			num: 12,
			handle: '@aaronrogers',
			info: 'This is some info about the player and sports.'
		},
		{
			num: 7,
			handle: '@benroethlisberger',
			info: 'This is some info about the player and sports.'
		},
		{
			num: 9,
			handle: '@drewbrees',
			info: 'This is some info about the player and sports.'
		},
		{
			num: 18,
			handle: '@peytonmanning',
			info: 'This is some info about the player and sports.'
		}
	];
	
	var moveCard = function() {
		var self = $(this);
		var selfIndex = self.index();
		var selfO = self.offset();
		var ty = w.innerHeight()/2 - selfO.top -4;
		
		var color = self.css('border-top-color');
		cardfulltop.css('background-color', color);
		cardhandle.css('color', color);
		
		updateData(selfIndex);
		
		self.css({
			'transform': 'translateY(' + ty + 'px)'
		});
				
		self.on('transitionend', function() {
			cardfull.addClass('active');
			self.off('transitionend');
		});
		
		return false;
	};
	
	var closeCard = function() {
		cardfull.removeClass('active');
		cardnum.hide();
		cardinfo.hide();
		cardhandle.hide();
		cardfull.on('transitionend', function() {
			card.removeAttr('style');
			cardnum.show();
			cardinfo.show();
			cardhandle.show();
			cardfull.off('transitionend');
		});
	};
	
	var updateData = function(index) {
		cardnum.text(data[index].num);
		cardhandle.text(data[index].handle);
		cardinfo.text(data[index].info);
	};
	
	var bindActions = function() {
		card.on('click', moveCard);
		arrow.on('click', closeCard);
	};
	
	var init = function() {
		bindActions();
	};
	
	return {
		init: init
	};
	
}());

Cards.init();
            
          
!
999px
Loading ..................

Console