css Audio - Active file-generic CSS - Active Generic - Active HTML - Active JS - Active SVG - Active Text - Active file-generic Video - Active header Love html icon-new-collection icon-person icon-team numbered-list123 pop-out spinner split-screen star tv

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.

+ add another resource

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

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.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

            
              <main>
  <h1>Slide In Panel</h1>
  <a href="#" class="btn panel-open">Open Panel</a>
</main>

<div class="slide-panel from-right no-touch">
	<header class="panel-header">
			<h1>Title Goes Here</h1>
			<a href="#" class="panel-close">Close</a>
		</header>

		<div class="panel-container">
			<div class="panel-content">
				<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Quam magnam accusamus obcaecati nisi eveniet quo veniam quibusdam veritatis autem accusantium doloribus nam mollitia maxime explicabo nemo quae aspernatur impedit cupiditate dicta molestias consectetur, sint reprehenderit maiores. Tempora, exercitationem, voluptate. Sapiente modi officiis nulla sed ullam, amet placeat, illum necessitatibus, eveniet dolorum et maiores earum tempora, quas iste perspiciatis quibusdam vero accusamus veritatis. Recusandae sunt, repellat incidunt impedit tempore iusto, nostrum eaque necessitatibus sint eos omnis! Beatae, itaque, in. Vel reiciendis consequatur saepe soluta itaque aliquam praesentium, neque tempora. Voluptatibus sit, totam rerum quo ex nemo pariatur tempora voluptatem est repudiandae iusto, architecto perferendis sequi, asperiores dolores doloremque odit. Libero, ipsum fuga repellat quae numquam cumque nobis ipsa voluptates pariatur, a rerum aspernatur aliquid maxime magnam vero dolorum omnis neque fugit laboriosam eveniet veniam explicabo, similique reprehenderit at. Iusto totam vitae blanditiis. Culpa, earum modi rerum velit voluptatum voluptatibus debitis, architecto aperiam vero tempora ratione sint ullam voluptas non! Odit sequi ipsa, voluptatem ratione illo ullam quaerat qui, vel dolorum eligendi similique inventore quisquam perferendis reprehenderit quos officia! Maxime aliquam, soluta reiciendis beatae quisquam. Alias porro facilis obcaecati et id, corporis accusamus? Ab porro fuga consequatur quisquam illo quae quas tenetur.</p>

      </div> <!-- panel-content -->
    </div> <!-- panel-container -->
</div> <!-- panel -->
            
          
!
            
              /* Notes:
 * - Droid Sans Google Font
 * - Droid Serif Google Font
 * - CSS Reset
 * - Autoprefixer / Bourbon
 * - jQuery
 */

@import 'bourbon'; // http://bourbon.io/

/******************************
 *         Vars
 *****************************/
// colors
// https://coolors.co/4d5057-1f7a8c-c1292e-e0d0c1-ffffff
$color-1: #E0D0C1; // dusty
$color-2: #C1292E; // red
$color-3: #1F7A8C; // blue
$color-4: #ffffff; // white
$color-5: #4D5057; // gray

// fonts 
$primary-font: 'Droid Sans', sans-serif;
$secondary-font: 'Droid Serif', serif;

// panel size
$panel-width-S: 90%;
$panel-width-M: 70%;
$panel-width-L: 50%;


/******************************
 *         Mixins
 *****************************/
// rem fallback - credits: http://zerosixthree.se/

@function calculateRem($size) {
  $remSize: $size / 16px;
  @return $remSize * 1rem;
}

@mixin font-size($size) {
  font-size: $size;
  font-size: calculateRem($size);
}

// antialiasing mode font rendering

@mixin font-smoothing {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/******************************
 *         Layout
 *****************************/
// breakpoints
$S:     480px;   
$M:     768px;     
$L:     1170px;     

// media queries
@mixin MQ($canvas) {
  @if $canvas == S {
   @media only screen and (min-width: $S) { @content; } 
  }
  @else if $canvas == M {
   @media only screen and (min-width: $M) { @content; } 
  }
  @else if $canvas == L {
   @media only screen and (min-width: $L) { @content; } 
  }
}

/* -------------------------------- 
Primary style
-------------------------------- */

*, *::after, *::before {
	@include box-sizing(border-box);
}

*::after, *::before {
	content: '';
}

body {
	font: {
		size: 100%;
		family: $primary-font;
	}
	color: $color-1;
	background: $color-3;
}

a {
	color: $color-2;
	text-decoration: none;
}

/* -------------------------------- 
Main components 
-------------------------------- */

main {
	text-align: center;

	h1 {
		@include font-size(32px);
		color: lighten($color-3, 16%);
		padding: 1em 0;
	}

	.btn {
		position: relative;
		display: inline-block;
		padding: 1em 2em;
		background-color: $color-2;
		color: $color-4;
		font-weight: bold;
		@include font-smoothing;
		border-radius: 50em;
		}
}

/* The Magic */
.slide-panel {
	position: fixed;
	top: 0;
	left: 0;
	height: 100%;
	width: 100%;
	visibility: hidden;
	@include transition(visibility 0s .6s);

	&::after {
		/* overlay layer */
		position: absolute;
		top: 0;
		left: 0;
		width: 100%;
		height: 100%;
		background: rgba(#000, 0);
		cursor: pointer;
		@include transition(background .3s .3s);
	}

	&.is-visible {
		visibility: visible;
		@include transition(visibility 0s 0s);

		&::after {
			background: rgba(#000, .6);
			@include transition(background .3s 0s);
		}

		.panel-close::before {
			@include animation(panel-close-1 .6s .3s);
		}

		.panel-close::after {
			@include animation(panel-close-2 .6s .3s);
		}
	}
}

@include keyframes(panel-close-1) {
	0%, 50% {
		@include transform(rotate(0));
	}

	100% {
		@include transform(rotate(45deg));
	}
}

@include keyframes(panel-close-2) {
	0%, 50% {
		@include transform(rotate(0));
	}

	100% {
		@include transform(rotate(-45deg));
	}
}

.panel-header {
	position: fixed;
	width: $panel-width-S;
	height: 50px;
	line-height: 50px;
	background: rgba($color-4, .96);
	z-index: 2;
	box-shadow: 0 1px 1px rgba(#000, .08);
	@include transition(top .3s 0s);

	h1 {
		font-weight: bold;
		color: $color-2;
		padding-left: 5%;
	}

	.from-right &, .from-left & {
		top: -50px;
	}

	.from-right & {
		right: 0;
	}

	.from-left & {
		left: 0;
	}

	.is-visible & {
		top: 0;
		@include transition(top .3s .3s);
	}

	@include MQ(M) {
		width: $panel-width-M;
	}

	@include MQ(L) {
		width: $panel-width-L;
	}
}

/* The Close Button */
.panel-close {
	position: absolute;
	top: 0;
	right: 0;
	height: 100%;
	width: 60px;

	/* image replacement */
	display: inline-block;
	overflow: hidden;
	text-indent: 100%;
	white-space: nowrap;

	&::before, &::after {
		/* close icon created in CSS */
		position: absolute;
		top: 22px;
		left: 20px;
		height: 3px;
		width: 20px;
		background-color: $color-3;
		/* this fixes a bug where pseudo elements are slighty off position */
		-webkit-backface-visibility: hidden;
		backface-visibility: hidden;
	}

  /* Mobile Defaults */
	&::before {
		@include transform(rotate(45deg));
	}

	&::after {
		@include transform(rotate(-45deg));
	}

  /* Modernizr -- Browser */
	.no-touch &:hover {
		background-color: $color-3;

		&::before, &::after {
			background-color: $color-4;
			@include transition-property(transform);
			@include transition-duration(.3s);
		}

		&::before {
			@include transform(rotate(220deg));
		}

		&::after {
			@include transform(rotate(135deg));
		}
	}
}

.panel-container {
	position: fixed;
	width: $panel-width-S;
	height: 100%;
	top: 0;
	background: $color-1;
	z-index: 1;
	@include transition-property(transform);
	@include transition-duration(.3s);
	@include transition-delay(.3s);

	.from-right & {
		right: 0;
		@include transform(translate3d(100%, 0, 0));
	}

	.from-left & {
		left: 0;
		@include transform(translate3d(-100%, 0, 0));
	}

	.is-visible & {
		@include transform(translate3d(0, 0, 0));
		@include transition-delay(0s);
	}

	@include MQ(M) {
		width: $panel-width-M;
	}

	@include MQ(L) {
		width: $panel-width-L;
	}
}

.panel-content {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	padding: 70px 5%;
	overflow: auto;

	/* smooth scrolling on touch devices */
	-webkit-overflow-scrolling: touch;

	p {
		@include font-size(14px);
		color: $color-5;
		line-height: 1.4;
		margin: 2em 0;

		&:first-of-type {
			margin-top: 0;
		}
	}

	@include MQ(M) {
		p {
			@include font-size(16px);
			line-height: 1.6;
		}
	}
}
            
          
!
            
              jQuery(document).ready(function($){
	//open the lateral panel
	$('.panel-open').on('click', function(event){
		event.preventDefault();
		$('.slide-panel').addClass('is-visible');
	});
	//close the lateral panel
	$('.slide-panel').on('click', function(event){
		if( $(event.target).is('.slide-panel') || $(event.target).is('.panel-close') ) { 
			$('.slide-panel').removeClass('is-visible');
			event.preventDefault();
		}
	});
});

// Show slide in preview (;
setTimeout(function(){
  $('.slide-panel').addClass('is-visible');
  
  setTimeout(function(){
    $('.slide-panel').removeClass('is-visible');
  }, 2000);
}, 50);
            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.
Loading ..................

Console