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.

            
              <div class="container">
  <h1>Slidin' Slidey Things</h1>
  <div class="slides">
    <div class="slide">
      <a href="#">The Lorem</a>
      <div class="content">
        Lorem ipsum dolor sit amet, consectetur adipisicing elit. Excepturi rem ab voluptate provident voluptatum veniam cupiditate beatae expedita veritatis aliquid officia doloribus dolore maiores doloremque mollitia! A ducimus autem ut!
        Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ducimus obcaecati velit autem tenetur doloribus perferendis esse odit animi quasi deserunt recusandae perspiciatis a sapiente aliquam qui libero dolor officiis assumenda.
      </div>
    </div>
    
    <div class="slide">
      <a href="#">The Ipsum</a>
      <div class="content">
        Lorem ipsum dolor sit amet, consectetur adipisicing elit. Excepturi rem ab voluptate provident voluptatum veniam cupiditate beatae expedita veritatis aliquid officia doloribus dolore maiores doloremque mollitia! A ducimus autem ut!
        Lorem ipsum dolor sit amet, consectetur adipisicing elit. Esse harum eius voluptas dicta. Vero tempore rerum itaque? Quidem nobis vel consectetur sit amet illo dicta veniam ab ut libero officia!
      </div>
    </div>
    
    <div class="slide">
      <a href="#">The Dolor Sit Amet</a>
      <div class="content">
        Lorem ipsum dolor sit amet, consectetur adipisicing elit. Excepturi rem ab voluptate provident voluptatum veniam cupiditate beatae expedita veritatis aliquid officia doloribus dolore maiores doloremque mollitia! A ducimus autem ut!
        Lorem ipsum dolor sit amet, consectetur adipisicing elit. Enim fugiat officiis repellat reprehenderit incidunt deserunt illum eum ipsa quod nihil eligendi hic delectus quaerat. Ad sint tempore cumque mollitia reiciendis!
      </div>
    </div>
  </div>
</div>
            
          
!
            
              @import "bourbon";

$primary-color: hsl(350, 70, 60);

.slides {
  position: relative;
  @extend .cf;

  .slide {
    position: absolute;
    top: 0; // Have to declare this for transition: top to work
    width: calc(33% - 1em);
    max-height: 3.5em; // Kind of a magic number
    margin: 0.5em;
    padding: 1em;
    background: darken($primary-color, 20%);
    color: white;
    float: left;
    overflow: hidden;
    
    transition: max-height 0.25s       ease-in-out,
                width      0.25s 0.25s ease-in-out,
                left       0.25s 0.5s  ease-in-out,
                top        0.25s 0.75s ease-in-out;
    
    // This is probably the jankiest part
    @for $i from 1 through 3 {
      &:nth-child(#{$i}) {
        left: #{($i - 1) * 33.3333%};
      }
    }
 
    
    > a {
      display: block;
      padding-bottom: 1em;
      font-family: 'Oswald';
      text-transform: uppercase;
      text-decoration: none;
      color: lighten($primary-color, 15%);
      transition: color 2s;
    }
  }
  
  .slide.active {
    position: absolute;
    top: 4.5em;
    left: 0;
    width: 100%;
    max-height: 20em;
    float: none;
    
    transition: top        0.25s 1s    ease-in-out,
                left       0.25s 1.25s ease-in-out,
                width      0.25s 1.5s  ease-in-out,
                max-height 0.25s 1.75s ease-in-out;
    
    a { color: white; }
  }
}

/** PAGE STYLES **/
@import url(https://fonts.googleapis.com/css?family=Lato:300|Oswald);

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

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

html { font-size: 62.5%; }

body {
  background: $primary-color;
  font-family: 'Lato', sans-serif;
  font-size: 2em; 
  line-height: 1.5
}

.container {
  width: 90%;
  max-width: 1200px;
  margin: 0 auto;
}

h1 {
  margin: 0;
  padding: 1em;
  font-family: 'Oswald', sans-serif;
  font-size: 2em;
  text-transform: uppercase;
  text-align: center;
  color: lighten(hsl(120, 70, 70), 30%);
}

/**
 * For modern browsers
 * 1. The space content is one way to avoid an Opera bug when the
 *    contenteditable attribute is included anywhere else in the document.
 *    Otherwise it causes space to appear at the top and bottom of elements
 *    that are clearfixed.
 * 2. The use of `table` rather than `block` is only necessary if using
 *    `:before` to contain the top-margins of child elements.
 */
.cf:before,
.cf:after {
    content: " "; /* 1 */
    display: table; /* 2 */
}

.cf:after {
    clear: both;
}

/**
 * For IE 6/7 only
 * Include this rule to trigger hasLayout and contain floats.
 */
.cf {
    *zoom: 1;
}
            
          
!
            
              $('.slide a').click(function () {
  $('.slide.active').removeClass('active');
  $(this).closest('.slide').addClass('active');
  return false;
});
            
          
!
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