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 is required to process package imports. If you need a different preprocessor remove all packages first.

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

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="pen-outer">
  <div class="pulldown">
    <div class="pulldown-toggle pulldown-toggle-round"><div class="lines"></div></div>
    <div class="pulldown-menu">
      <ul>
        <li><a>Edit</a></li>
        <li><a>Delete</a></li>
      </ul>
    </div>
  </div>
  
  <div class="instructions">
    Click me! <br />
    <small>Tip! Try making this window mobile size for a responsive version!</small>
  </div>
</div>
              
            
!

CSS

              
                /* Pen styles */

body{
  background-color: #eee;
  font-family: 'Roboto', sans-serif;
}

.pulldown{
  margin: 60px auto 20px auto;
  width: 38px;
}

.instructions{
  text-align: center;
  color: #666;
}




/* Styles for our pulldown menus */
.pulldown{
  position: relative;
}

.pulldown .pulldown-toggle{
  cursor: pointer;
}

.pulldown .pulldown-toggle-round{
  height: 38px;
  width: 38px;
  border: 1px solid #bbb;
  border-radius: 19px;
  cursor: pointer;
  background-color: #fff;
}

.pulldown .pulldown-menu{
  position: absolute;
  top: 46px;
  left: 0px;
  width: 180px;
  background-color: #fff;
  border-radius: 4px;
  display: none;
  z-index: 10;

  box-shadow: 0px 2px 12px rgba(0,0,0,.2);
}

.pulldown-right .pulldown-menu{
  left: auto;
  right: 0px;
}

.pulldown-toggle.open + .pulldown-menu{
  display: block;

  -webkit-animation-name: openPullDown;
  animation-name: openPullDown;

  -webkit-animation-duration: 100ms;
  animation-duration: 100ms;
  -webkit-animation-fill-mode: both;
  animation-fill-mode: both;

  -webkit-transform-origin: left top;
  transform-origin: left top;
}

.pulldown-right .pulldown-toggle.open + .pulldown-menu{
  -webkit-transform-origin: right top;
  transform-origin: right top;
}

.pulldown-menu ul{
  list-style: none;
  padding: 0;
  margin: 4px 0;
}

.pulldown-menu ul li{
  padding: 0;
  margin: 0;
}

.pulldown-menu ul li a{
  display: block;
  height: 34px;
  padding: 0 10px;
  line-height: 34px;
  cursor: pointer;
  color: #555;
  text-decoration: none;
}

.pulldown-menu ul li a:hover{
  background-color: #f5f5f5;
}







/* 
  line icon animation 
  thanks to @SaraSoueidan - https://sarasoueidan.com/blog/navicon-transformicons/
*/
.pulldown-toggle-round{
  position: relative;
}

.pulldown-toggle-round .lines{
  position: absolute;
  top: 18px;
  left: 9px;

  display: inline-block;
  width: 20px;
  height: 2px;
  background: #888;
  border-radius: 1px;

  transition: all 200ms;
}

.pulldown-toggle-round .lines::before{
  position: absolute;
  top: -6px;

  content: '';
  display: inline-block;
  width: 20px;
  height: 2px;
  background: #888;
  border-radius: 1px;

  transform-origin: 50% 50%;
  transition: all 200ms;
}

.pulldown-toggle-round .lines::after{
  position: absolute;
  top: 6px;

  content: '';
  display: inline-block;
  width: 20px;
  height: 2px;
  background: #888;
  border-radius: 1px;

  transform-origin: 50% 50%;
  transition: all 200ms;
}


/* when open lines positions */
.pulldown-toggle-round.open .lines{
  background: transparent;
}

.pulldown-toggle-round.open .lines::before{
  top: 0px;
  transform: rotate3d(0, 0, 1, 45deg);
  -webkit-transform: rotate3d(0, 0, 1, 45deg);
}

.pulldown-toggle-round.open .lines::after{
  top: 0px;
  transform: rotate3d(0, 0, 1, -45deg);
  -webkit-transform: rotate3d(0, 0, 1, -45deg);
}




@media (max-width: 550px) {
  .pulldown .pulldown-menu{
    position: fixed;
    
    top: auto!important;
    left: 0px!important;
    right: 0px!important;
    bottom: 0px!important;
    
    width: 100%;
    background-color: rgba(0, 0, 0, .2);
    box-shadow: none;
    border-radius: 0;
  }

  .pulldown-toggle.open + .pulldown-menu{
    -webkit-animation-name: openPullDownMobile;
    animation-name: openPullDownMobile;

    -webkit-animation-duration: 200ms;
    animation-duration: 200ms;
  }

  .pulldown-menu ul{
    margin: 10px;
  }

  .pulldown-menu ul li a{
    display: block;
    height: 60px;
    padding: 0 10px;
    line-height: 60px;
    cursor: pointer;
    color: $primaryText;
    text-decoration: none;
  }

  .pulldown .pulldown-menu li{
    background-color: #fff;
    margin-bottom: 1px;
  }
}




/*
|
| Grow from origin
|
*/
@-webkit-keyframes openPullDown {
  0% {
    opacity: 0;
    -webkit-transform: scale(.7);
    transform: scale(.7);
  }

  100% {
    opacity: 1;
    -webkit-transform: scale(1);
    transform: scale(1);
  }
}

@keyframes openPullDown {
  0% {
    opacity: 0;
    -webkit-transform: scale(.7);
    -ms-transform: scale(.7);
    transform: scale(.7);
  }

  100% {
    opacity: 1;
    -webkit-transform: scale(1);
    -ms-transform: scale(1);
    transform: scale(1);
  }
}




/*
|
| Slide up from bottom
|
*/
@-webkit-keyframes openPullDownMobile {
  0% {
    -webkit-transform: translate(0%, 100%);
    transform: translate(0%, 100%);
  }

  100% {
    -webkit-transform: translate(0%, 0%);
    transform: translate(0%, 0%);
  }
}

@keyframes openPullDownMobile {
  0% {
    -webkit-transform: translate(0%, 100%);
    -ms-transform: translate(0%, 100%);
    transform: translate(0%, 100%);
  }

  100% {
    -webkit-transform: translate(0%, 0%);
    -ms-transform: translate(0%, 0%);
    transform: translate(0%, 0%);
  }
}
              
            
!

JS

              
                
// reference to last opened menu
var $lastOpened = false;

  
// simply close the last opened menu on document click
$(document).click(function(){
  if($lastOpened){
    $lastOpened.removeClass('open');
  }
});


// simple event delegation
$(document).on('click', '.pulldown-toggle', function(event){
  
  // jquery wrap the el
  var el = $(event.currentTarget);
  
  // prevent this from propagating up
  event.preventDefault();
  event.stopPropagation();

  // check for open state
  if(el.hasClass('open')){
    el.removeClass('open');
  }else{
    if($lastOpened){
      $lastOpened.removeClass('open');
    }
    el.addClass('open');
    $lastOpened = el;
  }
  
});
              
            
!
999px

Console