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. 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

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 class="sdcnt" id="sdcnt">
  <nav class="sdmenu sdm1" id="m1">
    <h2>Sidebar1</h2>
    <ul>
      <li><a href="#">Home<i></i></a></li>
      <li><a href="#">Services<i></i></a></li>
      <li><a href="#">About<i></i></a></li>
      <li><a href="#">Contact<i></i></a></li>
    </ul>
  </nav>
  <nav class="sdmenu sdm2" id="m2">
    <h2>Sidebar2</h2>
    <ul>
      <li><a href="#">Home<i></i></a></li>
      <li><a href="#">Services<i></i></a></li>
      <li><a href="#">About<i></i></a></li>
      <li><a href="#">Contact<i></i></a></li>
    </ul>
  </nav>
  <nav class="sdmenu sdm4" id="m4">
    <h2>Sidebar3</h2>
    <ul>
      <li><a href="#">Home<i></i></a></li>
      <li><a href="#">Services<i></i></a></li>
      <li><a href="#">About<i></i></a></li>
      <li><a href="#">Contact<i></i></a></li>
    </ul>
  </nav>
  <nav class="sdmenu sdm5" id="m5">
    <h2>Sidebar4</h2>
    <ul>
      <li><a href="#">Home<i></i></a></li>
      <li><a href="#">Services<i></i></a></li>
      <li><a href="#">About<i></i></a></li>
      <li><a href="#">Contact<i></i></a></li>
    </ul>
  </nav>
  <nav class="sdmenu sdm9" id="m9">
    <h2>Sidebar5</h2>
    <ul>
      <li><a href="#">Home<i></i></a></li>
      <li><a href="#">Services<i></i></a></li>
      <li><a href="#">About<i></i></a></li>
      <li><a href="#">Contact<i></i></a></li>
    </ul>
  </nav>
  <nav class="sdmenu sdm10" id="m10">
    <h2>Sidebar6</h2>
    <ul>
      <li><a href="#">Home<i></i></a></li>
      <li><a href="#">Services<i></i></a></li>
      <li><a href="#">About<i></i></a></li>
      <li><a href="#">Contact<i></i></a></li>
    </ul>
  </nav>
  <nav class="sdmenu sdm11" id="m11">
    <h2>Sidebar7</h2>
    <ul>
      <li><a href="#">Home<i></i></a></li>
      <li><a href="#">Services<i></i></a></li>
      <li><a href="#">About<i></i></a></li>
      <li><a href="#">Contact<i></i></a></li>
    </ul>
  </nav>
  <nav class="sdmenu sdm12" id="m12">
    <h2>Sidebar8</h2>
    <ul>
      <li><a href="#">Home<i></i></a></li>
      <li><a href="#">Services<i></i></a></li>
      <li><a href="#">About<i></i></a></li>
      <li><a href="#">Contact<i></i></a></li>
    </ul>
  </nav>
  <nav class="sdmenu sdm13" id="m13">
    <h2>Sidebar9</h2>
    <ul>
      <li><a href="#">Home<i></i></a></li>
      <li><a href="#">Services<i></i></a></li>
      <li><a href="#">About<i></i></a></li>
      <li><a href="#">Contact<i></i></a></li>
    </ul>
  </nav>
  <div class="sd-psh">
    <nav class="sdmenu sdm3" id="m3">
      <h2>Sidebar10</h2>
      <ul>
        <li><a href="#">Home<i></i></a></li>
        <li><a href="#">Services<i></i></a></li>
        <li><a href="#">About<i></i></a></li>
        <li><a href="#">Contact<i></i></a></li>
      </ul>
    </nav>
    <nav class="sdmenu sdm6" id="m6">
      <h2>Sidebar11</h2>
      <ul>
        <li><a href="#">Home<i></i></a></li>
        <li><a href="#">Services<i></i></a></li>
        <li><a href="#">About<i></i></a></li>
        <li><a href="#">Contact<i></i></a></li>
      </ul>
    </nav>
    <nav class="sdmenu sdm7" id="m7">
      <h2>Sidebar12</h2>
      <ul>
        <li><a href="#">Home<i></i></a></li>
        <li><a href="#">Services<i></i></a></li>
        <li><a href="#">About<i></i></a></li>
        <li><a href="#">Contact<i></i></a></li>
      </ul>
    </nav>
    <nav class="sdmenu sdm8" id="m8">
      <h2>Sidebar13</h2>
      <ul>
        <li><a href="#">Home<i></i></a></li>
        <li><a href="#">Services<i></i></a></li>
        <li><a href="#">About<i></i></a></li>
        <li><a href="#">Contact<i></i></a></li>
      </ul>
    </nav>
    <nav class="sdmenu sdm14" id="m14">
      <h2>Sidebar14</h2>
      <ul>
        <li><a href="#">Home<i></i></a></li>
        <li><a href="#">Services<i></i></a></li>
        <li><a href="#">About<i></i></a></li>
        <li><a href="#">Contact<i></i></a></li>
      </ul>
    </nav>
    <div class="sd-content">
      <div class="sd-content-inner">
        <header class="header">
          <h1>Sidebar Animations</h1>
        </header>
        <div>
          <div id="sd-trig">
            <button effect="sdm1">Slide in over</button>
            <button effect="sdm2">Slide in under</button>
            <button effect="sdm3">Push</button>
            <button effect="sdm4">Slide along</button>
            <button effect="sdm5">Reverse slide out</button>
            <button effect="sdm6">Rotate push</button>
            <button effect="sdm7">Rotate in</button>
            <button effect="sdm8">Rotate out</button>
            <button effect="sdm9">push down</button>
            <button effect="sdm10">Scale Up</button>
            <button effect="sdm11">Scale & slide</button>
            <button effect="sdm12">Open door</button>
            <button effect="sdm13">Slide down</button>
            <button effect="sdm14">swing in</button>
          </div>
        </div>
      </div>
    </div>
  </div>
</div>
              
            
!

CSS

              
                @import url('https://fonts.googleapis.com/css?family=Raleway:300,400')
html,
body,
.sdcnt,
.sd-psh,
.sd-content
  height 100%
  
html
  text-size-adjust 100%
  background #232323

body
  color #fff
  font-weight 400
  font-family: 'Raleway', sans-serif
  margin 0
  
ul
  list-style-type none

a
  text-decoration none
  color #eee

.header
  margin 50px 300px 


  h1
    margin 0
    font-weight 300
    font-size 2.5em
    color red
    

.main
  max-width 50em
  margin auto

button
  border none
  font-weight 400
  padding 0.6em 1.2em
  width 40%!important
  background transparent
  color whitesmoke
  outline -webkit-focus-ring-color auto 5px;
  font-size 1em
  text-transform uppercase
  display inline-block
  margin 3px 3px
  border 1px solid #121212
  &:hover
    background rgba(0,0,0,0.25)

.sd-content
  overflow-y scroll
  background #222
  padding-left 300px


.sd-content,
.sd-content-inner
  position relative

.sdcnt
  position relative
  overflow hidden

.sd-psh
  position relative
  left 0
  z-index 99
  height 100%
  perspective 1000px
  transition -webkit-transform 0.5s
  transition transform 0.5s
  &::after
    position absolute
    top 0
    right 0
    width 0
    height 0
    background rgba(0,0,0,0.2)
    content ''
    opacity 0
    transition opacity 0.5s, width 0.1s 0.5s, height 0.1s 0.5s

.sdmenu-open
  .sd-psh
    &::after
      width 100%
      height 100%
      opacity 1
      transition opacity 0.5s
  .sdmenu
    &::after
      width 0
      height 0
      opacity 0
      transition opacity 0.5s, width 0.1s 0.5s, height 0.1s 0.5s

.sdmenu
  position absolute
  top 0
  left 0
  z-index 100
  visibility hidden
  width 300px
  height 100%
  background rgba(0,0,0,0.47)
  transition all 0.5s
  border 1px solid #000
  &::after
    position absolute
    top 0
    right 0
    width 100%
    height 100%
    background rgba(0,0,0,0.2)
    content ''
    opacity 1
    transition opacity 0.5s
  ul
    margin 0
    padding 0
    lisd-style none
    li
      a
        display block
        padding 1em 1em 1em 1.2em
        outline none
        box-shadow inset 0 -1px rgba(0,0,0,0.2)
        color #f3efe0
        text-transform uppercase
        text-shadow 0 0 1px rgba(255,255,255,0.1)
        letter-spacing 1px
        font-weight 400
        transition background 0.3s, box-shadow 0.3s
        &:hover
          background rgba(0,0,0,0.2)
          box-shadow inset 0 -1px rgba(0,0,0,0)
          color #fff
      &:firsd-child
        a
          box-shadow inset 0 -1px rgba(0,0,0,0.2), inset 0 1px rgba(0,0,0,0.2)
  h2
    margin 0
    padding 1em
    color whitesmoke
    text-shadow 0 0 1px rgba(0,0,0,0.1)
    font-weight 300
    font-size 2em

.sdm1
  &.sdmenu
    visibility visible
    transform translate3d(-100%, 0, 0)
    &::after
      display none
  &.sdmenu-open
    .sdm1
      &.sdmenu
        visibility visible
        transform translate3d(0, 0, 0)

.sdm2
  &.sdmenu-open
    .sd-psh
      transform translate3d(300px, 0, 0)
      transform translate3d(300px, 0, 0)
    .sdm2
      &.sdmenu
        visibility visible
        transition -webkit-transform 0.5s
        transition transform 0.5s
  &.sdmenu
    z-index 1

.sdmenu-2
  &.sdmenu
    &::after
      display none

.sdm3
  &.sdmenu-open
    .sd-psh
      transform translate3d(300px, 0, 0)
      transform translate3d(300px, 0, 0)
    .sdm3
      &.sdmenu
        visibility visible
        transition -webkit-transform 0.5s
        transition transform 0.5s
  &.sdmenu
    transform translate3d(-100%, 0, 0)
    transform translate3d(-100%, 0, 0)
    &::after
      display none

.sdm4
  &.sdmenu-open
    .sd-psh
      transform translate3d(300px, 0, 0)
      transform translate3d(300px, 0, 0)
    .sdm4
      &.sdmenu
        visibility visible
        transition -webkit-transform 0.5s
        transition transform 0.5s
        transform translate3d(0, 0, 0)
  &.sdmenu
    z-index 1
    transform translate3d(-50%, 0, 0)
    &::after
      display none

.sdm5
  &.sdmenu-open
    .sd-psh
      transform translate3d(300px, 0, 0)
      transform translate3d(300px, 0, 0)
    .sdm5
      &.sdmenu
        visibility visible
        transition -webkit-transform 0.5s
        transition transform 0.5s
        transform translate3d(0, 0, 0)
  &.sdmenu
    z-index 1
    transform translate3d(50%, 0, 0)

.sdm6
  &.sdcnt
    perspective 2000px
    perspective 2000px
  .sd-psh
    transform-origin 0 50%
    transform-origin 0 50%
    transform-style preserve-3d
  &.sdmenu-open
    .sd-psh
      transform translate3d(35.4%, 0, 0) rotateY(-15deg)
      transform translate3d(35.4%, 0, 0) rotateY(-15deg)
    .sdm6
      &.sdmenu
        visibility visible
        transition -webkit-transform 0.5s
        transition transform 0.5s
        transform translate3d(-100%, 0, 0) rotateY(15deg)
  &.sdmenu
    transform translate3d(-100%, 0, 0)
    transform translate3d(-100%, 0, 0)
    transform-origin 100% 50%
    transform-style preserve-3d
    &::after
      display none

.sdm7
  &.sdcnt
    perspective 1500px
    perspective 1500px
    perspective-origin 0 50%
  .sd-psh
    transform-style preserve-3d
    transform-style preserve-3d
  &.sdmenu-open
    .sd-psh
      transform translate3d(300px, 0, 0)
      transform translate3d(300px, 0, 0)
    .sdm7
      &.sdmenu
        visibility visible
        transition -webkit-transform 0.5s
        transition transform 0.5s
        transform translate3d(-100%, 0, 0) rotateY(0deg)
  &.sdmenu
    transform translate3d(-100%, 0, 0) rotateY(-90deg)
    transform translate3d(-100%, 0, 0) rotateY(-90deg)
    transform-origin 100% 50%
    transform-style preserve-3d

.sdm8
  &.sdcnt
    perspective 1500px
    perspective 1500px
    perspective-origin 0 50%
  .sd-psh
    transform-style preserve-3d
    transform-style preserve-3d
  &.sdmenu-open
    .sd-psh
      transform translate3d(300px, 0, 0)
      transform translate3d(300px, 0, 0)
    .sdm8
      &.sdmenu
        visibility visible
        transition -webkit-transform 0.5s
        transition transform 0.5s
        transform translate3d(-100%, 0, 0) rotateY(0deg)
  &.sdmenu
    transform translate3d(-100%, 0, 0) rotateY(90deg)
    transform translate3d(-100%, 0, 0) rotateY(90deg)
    transform-origin 100% 50%
    transform-style preserve-3d
    &::after
      display none

.sdm9
  &.sdcnt
    perspective 1500px
    perspective 1500px
  .sd-psh
    transform-style preserve-3d
    transform-style preserve-3d
  &.sdmenu-open
    .sd-psh
      transform translate3d(0, 0, -300px)
      transform translate3d(0, 0, -300px)
    .sdm9
      &.sdmenu
        visibility visible
        transition -webkit-transform 0.5s
        transition transform 0.5s
        transform translate3d(0, 0, 0)
  &.sdmenu
    opacity 1
    transform translate3d(-100%, 0, 0)
    &::after
      display none

.sdm10
  &.sdcnt
    perspective 1500px
    perspective 1500px
    perspective-origin 0 50%
  &.sdmenu-open
    .sd-psh
      transform translate3d(300px, 0, 0)
      transform translate3d(300px, 0, 0)
    .sdm10
      &.sdmenu
        visibility visible
        transition -webkit-transform 0.5s
        transition transform 0.5s
        transform translate3d(0, 0, 0)
  &.sdmenu
    z-index 1
    opacity 1
    transform translate3d(0, 0, -300px)

.sdm11
  &.sdcnt
    perspective 1500px
    perspective 1500px
  .sd-psh
    transform-style preserve-3d
    transform-style preserve-3d
  &.sdmenu-open
    .sd-psh
      transform translate3d(100px, 0, -600px) rotateY(-20deg)
      transform translate3d(100px, 0, -600px) rotateY(-20deg)
    .sdm11
      &.sdmenu
        visibility visible
        transition -webkit-transform 0.5s
        transition transform 0.5s
        transform translate3d(0, 0, 0)
  &.sdmenu
    opacity 1
    transform translate3d(-100%, 0, 0)
    &::after
      display none

.sdm12
  &.sdcnt
    perspective 1500px
    perspective 1500px
  .sd-psh
    transform-origin 100% 50%
    transform-origin 100% 50%
    transform-style preserve-3d
  &.sdmenu-open
    .sd-psh
      transform rotateY(-10deg)
      transform rotateY(-10deg)
    .sdm12
      &.sdmenu
        visibility visible
        transition -webkit-transform 0.5s
        transition transform 0.5s
        transform translate3d(0, 0, 0)
  &.sdmenu
    opacity 1
    transform translate3d(-100%, 0, 0)
    &::after
      display none

.sdm13
  &.sdcnt
    perspective 1500px
    perspective 1500px
    perspective-origin 0 50%
  &.sdmenu-open
    .sd-psh
      transform translate3d(300px, 0, 0)
      transform translate3d(300px, 0, 0)
    .sdm13
      &.sdmenu
        visibility visible
        transition-timing-function ease-in-out
        transitionfunction ease-in-out
        transition-property -webkit-transform
        transition-property transform
        transform translate3d(0, 0, 0)
  &.sdmenu
    z-index 1
    opacity 1
    transform translate3d(0, -100%, 0)

.sdm14
  &.sdcnt
    perspective 1500px
    perspective 1500px
    perspective-origin 0 50%
  .sd-psh
    transform-style preserve-3d
    transform-style preserve-3d
  &.sdmenu-open
    .sd-psh
      transform translate3d(300px, 0, 0)
      transform translate3d(300px, 0, 0)
    .sdm14
      &.sdmenu
        visibility visible
        transition-delay 0.1s
        transition-timing-function ease-in-out
        transitionfunction ease-in-out
        transition-property -webkit-transform
        transition-property transform
        transform translate3d(-100%, 0, 0) rotateY(0deg)
  &.sdmenu
    transform translate3d(-100%, 0, 0) rotateY(90deg)
    transform translate3d(-100%, 0, 0) rotateY(90deg)
    transform-origin 0 50%
    transform-style preserve-3d

.ion-ios-arrow-forward
  float right

.h2,
.ion-ios-home
  padding 0.3em

::-webkit-scrollbar
  z-index 30
  width 5px
  height 0
  y-index hidden

::-webkit-scrollbar-track
  background-color #111
  border-radius 0
  box-shadow none
  border 0

::-webkit-scrollbar-thumb
  background-color #2b2e33
  border-radius 0
  box-shadow none
  border 0
  &:hover
    background-color transparent

 
              
            
!

JS

              
                
function menuEffects() {

  function hasParentClass(e, classname) {
    if (e === document) {
      return false;
    } else if(e.classList.contains(classname)) {
      return true;
    } else {
      return e.parentNode && hasParentClass(e.parentNode, classname);
    }
  }


  let container = document.getElementById('sdcnt'),
      buttons = document.querySelectorAll('#sd-trig > button');

  function bodyClickFn(evt) {
    if (!hasParentClass(evt.target, 'sdmenu')) {
      container.classList.remove('sdmenu-open');
      document.removeEventListener('click', bodyClickFn);
    }
  }

  buttons.forEach(function (ele) {
    let effect = ele.getAttribute('effect');
    ele.addEventListener('click', function(evt){
      evt.stopPropagation();
      evt.preventDefault();
      container.className = 'sdcnt';
      container.classList.add(effect);
      setTimeout(function () {
        container.classList.add('sdmenu-open');
      }, 25);
      document.addEventListener('click', bodyClickFn);
    });
  });

}

menuEffects()


// demo only page animations
document.querySelectorAll('a').forEach(function(x){
  x.classList.add('hvr-underline-from-left','hvr-wobble-horizontal')
});

document.querySelectorAll('i').forEach(function(x){
  x.classList.add('ion-ios-arrow-forward')
});

document.querySelectorAll('button').forEach(function(x){
  x.classList.add('animated','bounceIn','hvr-pulse-grow')
});

document.querySelectorAll('h1').forEach(function(x){
  x.classList.add('animated','bounceIn','hvr-pulse-grow')
});

document.querySelectorAll('h2').forEach(function(x){
  x.classList.add('animated','bounceIn','hvr-wobble-skew')
});

              
            
!
999px

Console