Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs 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 its URL and the proper URL extension.

+ 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

Auto Save

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 class="wrap">
  <div class="fd-app">
    <div class="sidebar1">
      <div class="sidebar-menu">
        <p>DND Menu</p>
        <ul>
          <li>
            <a href="">Menu item</a>
          </li>
          <li>
            <a href="">Menu item</a>
          </li>
          <li>
            <a href="">Menu item</a>
          </li>
          <li>
            <a href="">Menu item</a>
          </li>
          <li>
            <a href="">Menu item</a>
          </li>
          <li>
            <a href="">Menu item</a>
          </li>
          <li>
            <a href="">Menu item</a>
          </li>
          <li>
            <a href="">Menu item</a>
          </li>
          <li>
            <a href="">Menu item</a>
          </li>
          <li>
            <a href="">Menu item</a>
          </li>
          <li>
            <a href="">Menu item</a>
          </li>
          <li>
            <a href="">Menu item</a>
          </li>
          <li>
            <a href="">Menu item</a>
          </li>
          <li>
            <a href="">Menu item</a>
          </li>
          <li>
            <a href="">Menu item</a>
          </li>
          <li>
            <a href="">Menu item</a>
          </li>
          <li>
            <a href="">Menu item</a>
          </li>
          <li>
            <a href="">Menu item</a>
          </li>
          <li>
            <a href="">Menu item</a>
          </li>
          <li>
            <a href="">Menu item</a>
          </li>
          <li>
            <a href="">Menu item</a>
          </li>
          <li>
            <a href="">Menu item</a>
          </li>
          <li>
            <a href="">Menu item</a>
          </li>
          <li>
            <a href="">Menu item</a>
          </li>
          <li>
            <a href="">Menu item</a>
          </li>
          <li>
            <a href="">Menu item</a>
          </li>
          <li>
            <a href="">Menu item</a>
          </li>
          <li>
            <a href="">Menu item</a>
          </li>
          <li>
            <a href="">Menu item</a>
          </li>
          <li>
            <a href="">Menu item</a>
          </li>
          <li>
            <a href="">Menu item</a>
          </li>
          <li>
            <a href="">Menu item</a>
          </li>
          <li>
            <a href="">Menu item</a>
          </li>
          <li>
            <a href="">Menu item</a>
          </li>
          <li>
            <a href="">Menu item</a>
          </li>
          <li>
            <a href="">Menu item</a>
          </li>
          <li>
            <a href="">Menu item</a>
          </li>
          <li>
            <a href="">Menu item</a>
          </li>
          <li>
            <a href="">Menu item</a>
          </li>
          <li>
            <a href="">Menu item</a>
          </li>
          <li>
            <a href="">Menu item</a>
          </li>
          <li>
            <a href="">Menu item</a>
          </li>
          <li>
            <a href="">Menu item</a>
          </li>
          <li>
            <a href="">Menu item</a>
          </li>
        </ul>
      </div>
    </div>
    <div class="sidebar2">
      <div class="sidebar-menu">
        <p>Properties Menu</p>
        <ul>
          <li>
            <a href="">Prop1</a>
          </li>
          <li>
            <a href="">Prop2</a>
          </li>
          <li>
            <a href="">Prop3</a>
          </li>
          <li>
            <a href="">Prop4</a>
          </li>
          <li>
            <a href="">Prop1</a>
          </li>
          <li>
            <a href="">Prop2</a>
          </li>
          <li>
            <a href="">Prop3</a>
          </li>
          <li>
            <a href="">Prop4</a>
          </li>
          <li>
            <a href="">Prop1</a>
          </li>
          <li>
            <a href="">Prop2</a>
          </li>
          <li>
            <a href="">Prop3</a>
          </li>
          <li>
            <a href="">Prop4</a>
          </li>
          <li>
            <a href="">Prop1</a>
          </li>
          <li>
            <a href="">Prop2</a>
          </li>
          <li>
            <a href="">Prop3</a>
          </li>
          <li>
            <a href="">Prop4</a>
          </li>
          <li>
            <a href="">Prop1</a>
          </li>
          <li>
            <a href="">Prop2</a>
          </li>
          <li>
            <a href="">Prop3</a>
          </li>
          <li>
            <a href="">Prop4</a>
          </li>
          <li>
            <a href="">Prop1</a>
          </li>
          <li>
            <a href="">Prop2</a>
          </li>
          <li>
            <a href="">Prop3</a>
          </li>
          <li>
            <a href="">Prop4</a>
          </li>
          <li>
            <a href="">Prop1</a>
          </li>
          <li>
            <a href="">Prop2</a>
          </li>
          <li>
            <a href="">Prop3</a>
          </li>
          <li>
            <a href="">Prop4</a>
          </li>
          <li>
            <a href="">Prop1</a>
          </li>
          <li>
            <a href="">Prop2</a>
          </li>
          <li>
            <a href="">Prop3</a>
          </li>
          <li>
            <a href="">Prop4</a>
          </li>
          <li>
            <a href="">Prop1</a>
          </li>
          <li>
            <a href="">Prop2</a>
          </li>
          <li>
            <a href="">Prop3</a>
          </li>
          <li>
            <a href="">Prop4</a>
          </li>
          <li>
            <a href="">Prop1</a>
          </li>
          <li>
            <a href="">Prop2</a>
          </li>
          <li>
            <a href="">Prop3</a>
          </li>
          <li>
            <a href="">Prop4</a>
          </li>
        </ul>
      </div>
    </div>
    <div class="nav-panel">
      <div class="nav-wrap">
        <button class="sidebar-toggle1"><i class="fa fa-plus icon"></i></button>
        <button class="sidebar-toggle2"><i class="fa fa-cogs icon"></i></button>
      </div>
    </div>
    <div class="doc-container">
      <div class="document">
        <div class="order-container">
          <div class="toggle-menu" id="order-menu">
            <div class="cut-paste">
              <i class="fa fa-scissors" aria-hidden="true"></i>
              <i class="fa fa-trash" aria-hidden="true"></i>
            </div>
            <div class="props"><i class="fa fa-cog" aria-hidden="true"></i></div>
          </div>
          <span class="order" id="order">Main Content</span></div>
        <div class="hint">Click "Main Content"<br/>Click Alt + M to toggle Properties menu once "Main content" is selected<br />
        You can also toggle the sidebar by clicking the cog in the context menu when "Main content" is selected</div>
        </div>
    </div>
  </div>
</div>
              
            
!

CSS

              
                // COLORS
$white: #fff;
$main-color: #29C7D2;
$sub-color: #253FE1;

$color__bg: $sub-color;
$color__sidebar: $white;
$color__toggle: $sub-color;

// SIZES
$width__sidebar1: 210px;
$width__sidebar2: 320px;

* {
  box-sizing: border-box;
}

body {
  background-color: #f1f1f1;
}
.container {
  padding: 0;
}
.header {
  height: 60px;
  background-color: red;
}
.row.sticky {
  margin: 0;
}
.fd-app {
  position: relative;
  width: 100%;
  display: block;
  height: 100vh;
  overflow: hidden;
}
.nav-panel {
    top: 0px;
    position: fixed;
    display: inline-block;
    width: 40px;
    z-index: 11;
  .nav-wrap {
      position: relative;
      display: inline;
      flex-direction: column;
      background-color: #243358;
      display: flex;
      flex-direction: column;
    &:before {
      position: absolute;
      padding: 20px;
      content: '';
      height: 100%;
      min-height: 1300px;
      background-color: #243358;
    }
  }
}
.doc-container {
  position: absolute;
  background-color: yellow;
  transition: .25s;
  // padding: 10px;
  background-color: #f1f1f1;
  top: 0;
  right: 0;
  width: 600px;
  overflow-y: scroll;
  transform: translateX(0);
  height: 100%;
  .document {
    position: relative;
    border-left: 1px solid grey;
    border-right: 1px solid grey;
    // outline: 2px solid grey;
    width: 600px;
    height: 1242px;
    background-color: #ffffff;
    padding: 40px;
  }
}
.sidebar-toggle1, .sidebar-toggle2 {
  // position: fixed;
  z-index: 1;
  width: 40px;
  height: 40px;
  outline: none !important;
  background-color: #243358;
  cursor: pointer;
  transition: .25s;
  border: 0;
  padding: 10px;
  border-radius: 0;
  &.active {
    background-color: #0C1630;
  }
  
  .icon {
    font-size: 16px;
    color: $white;
  }
}

.sidebar1 {
  width: $width__sidebar1;
  // min-height: 1300px;
  // height: 100%;
  background-color: #F6F7F8;
  transition: .7s;
  position: absolute;
  margin-left: 40px;
  transform: translateX(-240px);
  overflow-y: scroll;
  box-shadow: 2px 2px 4px 0px rgba(0,0,0,0.25);
  z-index: 10;
  height: 100%;
  .sidebar-menu {
  }
    ~ .doc-container.shift1 {
      transform: translate(0);
    }
  &.open-1 {
    transform: translateX(0);
    // ~ .doc-container {
    //   transform: translateX(233px);
    // }
  }
}
.sidebar2 {
  width: $width__sidebar2;
  background-color: #F6F7F8;
  transition: .7s;
  position: absolute;
  margin-left: 40px;
  transform: translateX(-570px);
  overflow-y: scroll;
  box-shadow: 2px 2px 4px 0px rgba(0,0,0,0.25);
  z-index: 10;
  height: 100%;
  .sidebar-menu {
    overflow-y: scroll;
  }
    ~ .doc-container.shift2 {
      transform: translate(0);
    }
  &.open-2 {
    transform: translateX(0);
    // ~ .doc-container {
    //   transform: translateX(355px);
    // }
  }
}
.order {
  font-family: Helvetica, Arial;
  font-size: 18px;
}
.doc-container.selected {
  .order {
    outline: 1px dotted blue;
  }
}
.sidebar-menu {
  li {
    height: 40px;
    a {
      padding: 10px;
      width: 100%;
      border-bottom: 1px solid #cbcbcb;
      width: 100%;
      display: block;
    }
  }
  p {
   padding: 10px;
    border-bottom: 1px solid #cbcbcb;
    width: 100%;
    display: block;
    margin-bottom: 0;
  }
}
@media (max-width: 1224px) {
  .doc-container {
    transform: none;
    position: absolute;
    top: 0;
    right: 80px;
  }
  .sidebar2.open-2 ~ .doc-container, .sidebar1.open-1 ~ .doc-container {
    transform: none;
    position: absolute;
    top: 0;
    right: 0;
    left: auto;
  }
}
.order-container {
  position: relative;
  display: inline-flex;
  .toggle-menu {
    display: none;
    position: absolute;
    top: -23px;
    right: -2px;
    left: auto;
    .props {
      width: 22px;
      height: 22px;
      border-radius: 22px;
      background-color: #555555;
      line-height: 23px;
      text-align: center;
      color: #ffffff;
      &:hover {
        background-color: #212121;
      }
    }
    &.props-open {
      .props {
        background-color: #F0D02E;
        color: #212121;
        &:hover {
          background-color: #DF9A08;
          cursor: pointer;
        }
      }
    }
  }
  .toggle-menu.menu-on {
    display: inline-flex;
    .cut-paste {
      display: inline-flex;
      background-color: #555555;
      color: #ffffff;
      border-radius: 22px;
      height: 22px;
      i {
        display: inline-flex;
        padding: 0 6px;
        line-height: 23px;
      }
    }
  }
  #order {
    cursor: pointer;
    user-select: none;
  }
}
.hint {
  padding: 20px 0;
  color: #727272;
}
              
            
!

JS

              
                var toggleBtn1 = document.querySelector('.sidebar-toggle1');
var toggleBtn2 = document.querySelector('.sidebar-toggle2');
var sidebar1 = document.querySelector('.sidebar1');
var sidebar2 = document.querySelector('.sidebar2');
var main = document.querySelector('.doc-container');
var order = document.querySelector('#order');
var orderNav = document.querySelector('#order-menu');

toggleBtn1.addEventListener('click', function() {
  // if sidebar2 is open, close it
  if(sidebar2.classList.contains('open-2')) {
    sidebar2.classList.toggle('open-2');
    main.classList.toggle('shift2');
    toggleBtn2.classList.toggle('active');
    orderNav.classList.toggle('props-open');
  };
  main.classList.toggle('shift1');
  sidebar1.classList.toggle('open-1');
  sidebar1.style.opacity = '1';
  sidebar2.style.opacity = '0';
  toggleBtn1.classList.toggle('active');
});


toggleBtn2.addEventListener('click', function() {
  //if sidebar 1 is open, close it
  if(sidebar1.classList.contains('open-1'))   {
    toggleDND()
  };
  toggleProps()
});

order.addEventListener('click', function() {
  main.classList.toggle('selected');
  orderNav.classList.toggle('menu-on');
});

// double click order and toggle props
order.addEventListener('dblclick', function() {
  main.classList.toggle('selected');
  orderNav.classList.toggle('menu-on');
  //if sidebar 1 is open, close it
  if(sidebar1.classList.contains('open-1'))   {
    toggleDND();
  };
  
  toggleProps();
});

//click context menu and toggle props
orderNav.addEventListener('click', function() {
   //if sidebar 1 is open, close it
  if(sidebar1.classList.contains('open-1'))   {
    toggleDND();
  };
  
  toggleProps();
});

function toggleDND() {
  sidebar1.classList.toggle('open-1');
  main.classList.toggle('shift1');
  toggleBtn1.classList.toggle('active');
}
function toggleProps() {
  main.classList.toggle('shift2');
  sidebar2.classList.toggle('open-2');
  sidebar2.style.opacity = '1';
  sidebar1.style.opacity = '0';
  toggleBtn2.classList.toggle('active'); 
  orderNav.classList.toggle('props-open');
}
//jwerty plugin for keypress
jwerty.key('alt+m', function () { 
  toggleProps();
});
              
            
!
999px

Console