Pen Settings

HTML

CSS

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. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ 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

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.

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.all-slides
  %h2.slides-title Slides
  %div.slides
    - (1..10).each do |i|
      %div.slide Slide
              
            
!

CSS

              
                * {
  box-sizing: border-box;
}

html {
  font-family: "Lucida Grande","Lucida Sans Unicode", Tahoma, sans-serif;
  font-size: 13px;
}

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

body {
  background: #8D939D;
  margin: 0;
}

.all-slides {
  background: #E3E7ED;
  counter-reset: slides;
  position: absolute;
  top: 0;
  left: 0;
  width: 150px;
  padding: 3rem 1rem 1rem 2rem;
  height: 100%;
  overflow: auto;
}

.slides-title {
  position: fixed;
  background: #E3E7ED;
  z-index: 8;
  width: 150px;
  text-align: center;
  top: 0;
  left: 0;
  margin: 0;
  border-bottom: 1px solid #CDD1D8;
  color: #8585A2;
  padding: 0.5rem 0.25rem;
  font-size: 1rem;
}

.slide {
  width: 100px;
  height: 60px;
  background: linear-gradient(#444, #111);
  position: relative;
  user-select: none;
  border: 1px solid white;
  margin: 0 0 0.75rem 0;
  box-shadow: 0 0 5px rgba(black, 0.5);
  text-align: center;
  color: white;
  line-height: 60px;
  font-size: 0.5rem;
  z-index: 5;
  &:before {
    position: absolute;
    bottom: 0;
    right: 100%;
    counter-increment: slides;
    content: counter(slides);
    padding-right: 0.35rem;
    color: #999;
    line-height: normal;
    font-size: 1rem;
  }
}

/* show above others */
.slide.is-dragging {
  z-index: 10;
}

.ui-sortable-helper {
  transition: none !important;
  animation: pulse 0.4s alternate infinite;
}

.sortable-placeholder {
  height: 60px;
  width: 5px;
  border-left: 2px solid #4999DA; 
  margin: 0 0 0.75rem 0;
  position: relative;
  z-index: 6;
}

@keyframes pulse {
  100% { transform: scale(1.1); } 
}

.cloned-slides {
  .slide {
    position: absolute;
    z-index: 1;
    &:before {
      content: attr(data-pos);
    }
  }
}
              
            
!

JS

              
                docReady( function() {

  var slidesElem = document.querySelector('.slides');
  var slideSize = getSize( document.querySelector('.slide') );
  var pckry = new Packery( slidesElem, {
    rowHeight: slideSize.outerHeight
  });
  // get item elements
  var itemElems = pckry.getItemElements();
  // for each item...
  for ( var i=0, len = itemElems.length; i < len; i++ ) {
    var elem = itemElems[i];
    // make element draggable with Draggabilly
    var draggie = new Draggabilly( elem, {
      axis: 'y'
    });
    // bind Draggabilly events to Packery
    pckry.bindDraggabillyEvents( draggie );
  }

  // re-sort DOM after item is positioned
  pckry.on( 'dragItemPositioned', function( _pckry, draggedItem ) {
    var index = pckry.items.indexOf( draggedItem );
    var nextItem = pckry.items[ index + 1 ];
    if ( nextItem ) {
      slidesElem.insertBefore( draggedItem.element, nextItem.element );
    } else {
      slidesElem.appendChild( draggedItem.element );
    }

  });

});

              
            
!
999px

Console