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 CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

Quick-add: + add another resource

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.

            
              <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ullam aut odit libero commodi, reiciendis iure magnam modi tempore. Repellendus, voluptas! Sunt magnam iusto, nam cum pariatur molestiae ipsam harum aperiam.</p>

<p data-height="537" data-theme-id="1" data-slug-hash="RNLdpz" data-default-tab="result" data-user="osublake" data-embed-version="2" data-pen-title="Sortable Grid Using GreenSock Draggable" class="codepen">See the Pen <a href="https://codepen.io/osublake/pen/RNLdpz/">Sortable Grid Using GreenSock Draggable</a> by Blake Bowen (<a href="https://codepen.io/osublake">@osublake</a>) on <a href="https://codepen.io">CodePen</a>.</p>
<script async src="https://production-assets.codepen.io/assets/embed/ei.js"></script>

<p>Alias maxime, accusamus amet quos aliquid non obcaecati aliquam quidem quod cumque accusantium! In voluptates, similique nihil consequuntur sequi nobis eaque quam praesentium quasi, laboriosam, provident minus molestiae est inventore.</p>
            
          
!
            
              .cp_embed_wrapper {
  position: relative;
  margin: 0 0 1rem 0;
  &.dragging {
    &::before {
      content: "";
      position: absolute;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      z-index: 4000;
    }
  }
  .cp_embed_iframe {
    display: block;
  }
}
.win-size-grip {
   position: absolute;
   width: 16px;
   height: 16px;
   padding: 4px;
   bottom: 0;
   right: 0;
   z-index: 5000;
   cursor: nwse-resize;
   background: url(https://s3-us-west-2.amazonaws.com/s.cdpn.io/3/wingrip.png) no-repeat;
 }

body {
  max-width: 780px;
  padding: 10px;
  margin: 0 auto;
  font: 22px/1.5 sans-serif;
}
            
          
!
            
              // This is the callback from CodePen's embed script, ei.js
function __CodePenIFrameAddedToPage() {
  makeEmbedsResizeable();
}

function makeEmbedsResizeable() {
  
  // You don't have to set min and max, but it's kinda useful so that users don't drag them to a weird/bad size.
  var maxWidth = 1000; // calculated below
  var minWidth = 320;
  var minHeight = 150; 
  
  $(".cp_embed_wrapper").each(function() {
    var $wrapper = $(this);
    var $iframe = $wrapper.find("iframe");
    $wrapper.append("<div class='win-size-grip'></div>");
    var originalHeight = $iframe.outerHeight();
    $wrapper.css("height", originalHeight);
    // Can't set this in CSS, otherwise height measurement will be wrong
    $iframe.css("height", "100%");
    $wrapper.resizable({
      handleSelector: "> .win-size-grip",
      onDragStart: function (e, $el, opt) {
        $el.addClass("dragging");
        maxWidth = window.outerWidth;
      },
      onDragEnd: function (e, $el, opt) {
        $el.removeClass("dragging");
      },
      onDrag: function (e, $el, newWidth, newHeight, opt) {
        if (newWidth > maxWidth) {
          newWidth = maxWidth;
        }
        if (newWidth < minWidth) {
          newWidth = minWidth;
        }
        if (newHeight < minHeight) {
          newHeight = minHeight;
        }
        $el.width(newWidth);
        $el.height(newHeight);
        return false;
      }
    });
  });
}


            
          
!
999px
Loading ..................

Console