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.

+ 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.

              <article id="slide-0" class="slide slide--locked">
  <img src="http://lorempixel.com/g/768/1152/people/8">
<article id="slide-1" class="slide slide--text slide--locked">
  <div class="slide__inner">
    <p>A Split screen gallery</p>
    <p class="demo-arrow">&darr;</p>
    <p class="demo-instructions">Scroll down</p>
<article id="slide-2" class="slide slide--scrolling slide--text">
  <div class="slide__inner">
    <p>It's a nice way to tell a story. Works as an image gallery as well.</p>
<article id="slide-3" class="slide">
  <img src="http://lorempixel.com/g/768/1152/people/3">
<article id="slide-4" class="slide">
  <img src="http://lorempixel.com/g/768/1152/people/9">
<article id="slide-5" class="slide slide--text">
  <div class="slide__inner">
    <p>Doesn't work on iOS because it uses fixed positioning. Fallback is necessary.</p>
<article id="slide-6" class="slide">
  <img src="http://www2.eduardoboucas.com/images/ElsaBW2.jpg">
<article id="slide-7" class="slide slide--text">
  <div class="slide__inner">
    <p>But that's life, isn't it?</p>
    <p class="demo-instructions">The end.</p>

              .slide {
  position: fixed;
  width: 50%;
  height: 100%;
  float: left;
  overflow: hidden;
  background-color: #ddd;
  &:nth-of-type(even) {
    right: 0;
  &:nth-of-type(odd) {
    left: 0;

.slide--text {
  background-color: white;
  padding: 30px;
  color: black;
  font-family: 'Fjalla One', sans-serif;
  text-align: center;
  text-transform: uppercase;

.slide__inner {
  height: 100%;
  border: 2px dashed black;
  padding: 20% 5% 5% 5%;
  font-size: 2em;

.slide--sticky {
  position: fixed !important;
  top: 0 !important;

.slide--scrolling {
  position: absolute;

// Demo stuff and reset
* {
  box-sizing: border-box;

html, body {
  margin: 0;

img {
  width: 100%;

.demo-instructions {
  font-size: 0.5em;

.demo-arrow {
  position: relative;
  animation: demo-arrow 0.4s ease-in-out infinite alternate;

a {
  color: inherit;

@keyframes demo-arrow {
  0% {
    top: 0;
  100% {
    top: 10px;
              var windowHeight = $(window).height();
var $slides = $('.slide');

function init() {
	$('body').css('height', ($slides.length * 100) + '%');
	$slides.each(function(index) {
      'z-index': index,
      'top': (index * 100) + '%'
	var $scrollingSlide = $('.slide--scrolling').last();
  var scrollingSlideIndex = $('.slide').index($scrollingSlide);
  $(window).scrollTop((scrollingSlideIndex - 1) * windowHeight);

function adjustPositions() {
	var scrollPosition = $(window).scrollTop();
	var scrollingSlide = Math.floor(scrollPosition / windowHeight) + 1;
  var $scrollingSlide = $('#slide-' + scrollingSlide);

$(document).ready(function() {

$(window).scroll(function () {
🕑 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 ..................