Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

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

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Auto Save

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

              
                div.wrapper
	div.cap
		h4.header Gem Encyclopaedia
		
	div.body
		div.carousel-container
			div.carousel
				div.carousel-item
					div.item
						div.gem.purple
				div.carousel-item
					div.item
						div.gem.red
				div.carousel-item
					div.item
						div.gem.blue
				div.carousel-item
					div.item
						div.gem.green
						
		div.content
			p.instructions.
				Swipe up and down with the arrow keys or mouse to view the different gems.
			div.item-content
				h3.header Item description
				p.description.
					You won’t get good at anything by doing it a lot fucking aimlessly. Intuition is fucking important. Never let your guard down by thinking you’re fucking good enough. Design as if your fucking life depended on it. Your rapidograph pens are fucking dried up, the x-acto blades in your bag are rusty, and your mind is dull.
			
	div.footer
		div.col-side
			input(type="button", value="Level 3").level-btn
		div.col-center
			span.progress-bar
				span.progress-bar__value
		div.col-side
			input(type="button", value="Level 4").level-btn
			
div.disclaimer
	p Vertical carousels though.
		
              
            
!

CSS

              
                // Compass
@import "compass";

// Font
@import url(https://fonts.googleapis.com/css?family=Roboto:300,400,500,700);

// Variables
$border-radius: 5px;
$color-purple: #48466D;

$gem-blue: #4AA0D5;
$gem-red: #E84545;
$gem-green: #B7E576;
$gem-purple: #6A2C70;

*, *:after, *:before {
	box-sizing: border-box;
}

body, html {
	height: 100%;
	overflow: hidden;
	width: 100%;
}

body {
	background-color: #311d3f;
	font-family: 'Roboto', Arial, sans-serif;
	@include filter-gradient(#311d3f, #88304e, horizontal);
	@include background-image(linear-gradient(left top, #311d3f 0%, #522546 60%, #522546 60%, #88304e 100%));
}

.disclaimer {
	color: #fff;
	margin: 50px auto 20px;
	opacity: .7;
	text-align: center;
	width: 600px;
	
	p {
		font-weight: 300;
		line-height: 160%;
	}
	
	a {
		color: #fff;
		font-weight: 500;
		text-decoration: none;
		transition: all .15s linear;
		
		&:hover {
			margin: 0 10px;
		}
	}
}

.wrapper {
	margin: 40px auto;
	width: 700px;
}

.cap {
	background: #f5f5f5;
	border-bottom: 1px solid #e5e5e5;
	border-radius: $border-radius $border-radius 0 0;
	padding: 20px;
	text-align: center;
	
	.header {
		font-size: 18px;
	}
	
	.hamburger {
		opacity: .3;
		
		&:before {
			font-size: 24px;
		}
	}
}

.body {
	background: #fff;
	color: #333;
	overflow: auto;
	
	.header {
		font-size: 18px;
		font-weight: 700;
		margin: 20px 0 15px;
		text-transform: capitalize;
	}
	
	.description {
		color: #666;
		font-size: 16px;
		line-height: 150%;
	}
	
	.instructions {
		line-height: 150%;
		margin-bottom: 50px;
		opacity: .5;
	}
	
	.carousel-container {
		float: left;
		height: 300px;
		overflow: hidden;
		width: 40%;
	}
	
	.content {
		border-left: 1px solid #eee;
		float: left;
		height: 300px;
		max-height: 300px;
		padding: 20px;
		width: 60%;
	}
}

.footer {
	background: #f5f5f5;
	border-radius: 0 0 $border-radius $border-radius;
	border-top: 1px solid #e5e5e5;
	overflow: auto;
	
	.col-side,
	.col-center {
		float: left;
		padding: 20px;
	}
	
	.col-side {
		width: 20%;
	}
	
	.col-center {
		width: 60%;
	}
}

// Progress bar
.progress-bar {
	background: #fff;
	border: 1px solid #e5e5e5;
	border-radius: 15px;
	display: block;
	height: 30px;
	margin-top: 12px;
	width: 100%;
	
	&__value {
		background: #3D84A8;
		background: #88304e;
		border: 5px solid #fff;
		border-radius: 15px;
		display: block;
		height: 100%;
		max-width: 100%;
		width: 23%;
	}
}

// Level buttons
.level-btn {
	background: $color-purple;
	border: 3px solid $color-purple;
	border-radius: 3px;
	box-shadow: 0 10px 20px transparentize(#88304e, .8);
	color: #fff;
	cursor: pointer;
	font-family: 'Roboto', Arial, sans-serif;
	font-size: 16px;
	outline: none;
	padding: 15px;
	transition: all .15s linear;
	width: 100%;
	
	&:hover {
		background: darken($color-purple, 5%);
		box-shadow: 0 10px 20px transparentize(#88304e, .6);
	}
}

// Slick plugin
.slick-slider {
	height: 50%;
	margin: 30% 0 20%;
}

.slick-list {
	overflow: visible;
}

.slick-slide {
	opacity: .4;
	outline: none;
	transition: opacity .15s linear;
	
	&.slick-active {
		opacity: 1;
	}
}

// Previous/Next level buttons
.item {
	height: 180px;
	padding: 20px;
	position: relative;
	text-align: center;
	
	.item-desc {
		background: #fff;
		padding: 10px;
	}
}

// Gems
.gem {
	margin: 0 auto;
	width: 80px;
	height: 80px;
	position: relative;
	background: $gem-purple;
	-webkit-transform: rotate(45deg);
	-moz-transform: rotate(45deg);
	-ms-transform: rotate(45deg);
	transform: rotate(45deg);
	@include background-image(linear-gradient(left top, $gem-purple 0%, darken($gem-purple, 15%) 100%));
	
	&.red {
		background: $gem-red;
		@include background-image(linear-gradient(left top, $gem-red 0%, darken($gem-red, 15%) 100%));
	}
	
	&.blue {
		background: $gem-blue;
		@include background-image(linear-gradient(left top, $gem-blue 0%, darken($gem-blue, 15%) 100%));
	}
	
	&.green {
		background: $gem-blue;
		@include background-image(linear-gradient(left top, $gem-green 0%, darken($gem-green, 15%) 100%));
	}
	
	&:after {
		border: 15px solid;
		border-color: rgba(0,0,0,0.2) rgba(255,255,255,0.15) rgba(0,0,0,0.25) rgba(255,255,255,0.4);
		content: "";
		height: 100%;
		left: 0;
		position: absolute;
		width: 100%;
		@include background-image(linear-gradient(top, rgba(255,255,255,0.0) 0%, rgba(255,255,255,0.15) 100%));
	}
}
              
            
!

JS

              
                // Gem descriptions
var gems = [{name: 'Amethyst', desc: 'The amethyst, considered the highest level crafting stone, aliquam dolores et eum. Et facilisis iracundia usu, an integre noluisse eos, ea eum quod error appetere.'},
		   {name: 'Ruby', desc: 'This polished ruby gem adds fire damage vel zril epicurei expetendis te, nec ea vidisse bonorum.'},
			{name: 'Topaz', desc: 'Topaz, mined from the crust of the underworld, dolores et eum. Et facilisis iracundia usu, an integre noluisse eos.'},
			{name: 'Emerald', desc: 'The basic emerald is not very exciting, but ea eum quod error appetere. At scribentur disputationi pro, cu quot tota singulis per.'}];

$('.content .header').html(gems[0].name);
$('.content .description').html(gems[0].desc)

var numSlides;
var $carousel = $('.carousel');

$carousel.on('beforeChange', function(event, slick, currentSlide, newSlide) {
	if (newSlide !== currentSlide) {
		$('.item-content').animate({ opacity: 0}, 150);
	}
}).on('afterChange', function(event, slick, currentSlide) {
	$('.item-content').animate({ opacity: 1}, 150);
	$('.content .header').html(gems[currentSlide].name);
	$('.content .description').html(gems[currentSlide].desc);
}).on('init', function(event, slick) {
	numSlides = slick.slideCount;
});

$carousel.slick({
	infinite: false,
	vertical: true,
	verticalSwiping: true,
	centerPadding: '40px',
	speed: 200,
	focusOnSelect: true,
	arrows: false
});

// Up/down arrows
$('html').keydown(function(event) {
	var currentSlide = $carousel.slick('slickCurrentSlide');
	
	// Up
	if (event.keyCode === 40 && currentSlide !== 0) {
		$carousel.slick("slickPrev");
	}
	else if (event.keyCode === 38 && numSlides - 1 !== currentSlide) {
		$carousel.slick("slickNext");
	}
});
              
            
!
999px

Console