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

+ add another resource


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


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.


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.


                <div class="header">
  <div id="move">Move</div>

<div id="content">
  <div id="row-0">Row 0</div>
  <div id="row-1">Row 1</div>
  <div id="row-2">Row 2</div>
  <div id="row-3">Row 3</div>
  <div id="row-4">Row 4</div>
  <div id="row-5">Row 5</div>



                .header {
  padding-bottom: 40px;



                var numOfRows = 6;

function init() {
  $("#move").click(function() {
    var $this = $(this);
    if (isMovingRows()) {
    } else {

function isMovingRows() {
  if ($("#move").hasClass("is-moving")) return true;
  return false;

function moveRowsStarted() {
  $("#move").html("Stop Moving").addClass("is-moving");
  for (var i = 0; i < numOfRows; i++) {
    makeRowsDraggable($("#row-" + i));

function moveRowsCompleted() {
  $("#move").html("Move Rows").removeClass("is-moving");
  for (var i = 0; i < numOfRows; i++) {
    var $row = $("#row-" + i);
    var draggable = Draggable.get($row);
    if (draggable) draggable.kill();

function makeRowsDraggable($row) {
  Draggable.create($row, {
    type: "y",
    cursor: "pointer",
    bounds: $("#content"),
    autoScroll: 1,
    onRelease: function() {
      var $dragRow = $(;
      var id = $dragRow.attr("id");
      var rowIds = [];
      for (var i = 0; i < numOfRows; i++) {
        var $row = $("#row-" + i);
        if (this.hitTest($row) && $row.attr("id") !== id) {

      if (rowIds.length == 1) {
        // positioned exactly on top of another row
        // if rowIds[0] == numOfRows then position below the last row and move others up
        // otherwise position at rowIds[0] location and move others down
        if (rowIds[0] == numOfRows - 1) $("#row-" + rowIds[0]).after($dragRow);
        else $("#row-" + rowIds[0]).before($dragRow);
      } else {
        // position between the two rows (rowIds[1] location and move others down)
        $("#row-" + rowIds[1]).before($dragRow);
      	var draggable = Draggable.get($dragRow);