cssAudio - ActiveCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - Activehtmlicon-personicon-teamoctocatspinnerstartv

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.

            
              @import "compass/css3";

@mixin center($widthHeight) {
  position: absolute;
  width: $widthHeight; height: $widthHeight;
  left: 50%;
  margin: -$widthHeight / 2,
}

$timing-function: cubic-bezier(1, 0, 0.755, 1.470);

* { box-sizing: border-box; }

html {
  height: 100%;
  background-image: radial-gradient(white, slategray);
}

#button {
  font-family: sans-serif;
  @include center(75px);
  line-height: 75px;
  background-color: black;
  border-radius: 50%;
  color: white;
  text-align: center;
  cursor: pointer;
  
  &:before {
    content: "\2630";
    font-size: 30px;
  }
}

.drop-down,
.drop-down + ul {
  animation: drop 100ms forwards $timing-function;
}

.rise-up,
.rise-up + ul {
  animation: rise 400ms forwards $timing-function;
}

.rise-up + ul li {
  pointer-events: none;
}

.rise-up {
  z-index: 1;
}

li {
  z-index: -1;
  @include center(75px);
  list-style: none;
  border-radius: 50%;
  transition: transform 300ms $timing-function;
  
  @for $i from 0 through 7 {
    &:nth-child(#{$i+1}) {
      background-color: hsl($i*45, 100%, 50%);
      
      .drop-down + ul & {
        transform: translateX((sin($i * 45deg))*100px) translateY(-(cos($i * 45deg))*100px);
      }
    }
  }
}

.selected {
  z-index: 1;
  transform: scale(1.2);
}

@keyframes rise {
  from { transform: translateY(200px); }
  to { transform: translateY(0); }
}

@keyframes drop {
  to { transform: translateY(200px); }
}

            
          
!
            
              var button = document.getElementById('button'),
    drop = document.getElementsByClassName('drop-down')[0],
    rise = document.getElementsByClassName('rise-up')[0];

button.addEventListener('click', menuClick, false);

function menuClick(){
  if (button.classList.contains('drop-down')){
     button.classList.remove('drop-down');
     button.classList.add('rise-up');
   } else {
     button.classList.remove('rise-up');
     button.classList.add('drop-down');  
   }
}

var swatch = document.getElementById('swatches');

swatch.addEventListener('click', swatchMenu, false);

function swatchMenu(e){
  var target = e.target,
      selected = swatch.querySelector("li.selected");

  if(selected){
    selected.classList.remove('selected');
  } 
  
  if(target.nodeName.toLowerCase() === 'li'){
    target.classList.toggle('selected');
    button.classList.remove('drop-down');
    button.classList.add('rise-up');
  }
}
            
          
!
999px
Close

Asset uploading is a PRO feature.

As a PRO member, you can drag-and-drop upload files here to use as resources. Images, Libraries, JSON data... anything you want. You can even edit them anytime, like any other code on CodePen.

Go PRO

Loading ..................

Console