cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

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

Quick-add: + add another resource

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.

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.

            
              <h1 class="text-center">Blink dropdown menu</h1>
<p class="text-center">A dropdown menu that has a blink animation when an item is selected.<br>Inspired by Mac OS menus.</p>

<div class="dropdown">
  <button class="btn-dropdown" type="button" data-toggle="dropdown">
    Dropdown
    <span class="caret"></span>
  </button>
  <ul id="dropdown-menu" class="closed">
    <li><a href="#">First item</a></li>
    <li><a href="#">Second item</a></li>
    <li><a href="#">Third item</a></li>
    <li><a href="#">Fourth item</a></li>
    <li><a href="#">Fifth item</a></li>
  </ul>
</div>

            
          
!
            
              @import "bourbon";

$blue: #3498DB;
$gray: #EEE;

body {
  margin: 40px;
  font-family: Arial, sans-serif;
  font-size: 15px;
}

.text-center {
  text-align: center;
}

.graphic {
  margin: 0 auto;
  display: block;
}

.dropdown {
  display: inline-block;
  position: relative;
  left: 50%;
  margin-top: 20px;
  margin-left: -60px;
}

button {
  background: $blue;
  border: 0;
  color: #FFF;
  outline: none;
  border-radius: 6px;
  padding: 12px 14px;
  cursor: pointer;
  font-size: 14px;
  
  &:hover {
    background: darken($blue, 10%);
  }
}

.caret {
  display: inline-block;
  width: 0;
  height: 0;
  margin-left: 2px;
  vertical-align: middle;
  border-top: 8px dashed;
  border-right: 6px solid transparent;
  border-left: 6px solid transparent;
}

#dropdown-menu {
  background: $gray;
  overflow: hidden;
  border-radius: 6px;
  list-style: none;
  margin: 5px 0 0 0;
  padding: 0;
  width: 200px;
  visibility: hidden;
  opacity: 0;
  @include transition(all 500ms);
  
  &.open {
    visibility: visible;
    opacity: 1;
    @include transition(none);
  }
  
  li {
    &:hover {
     background: $blue;
      
      a {
        color: #FFF;
      }
    }
  }
  
  a {
    display: block;
    padding: 10px;
    color: #000;
    text-decoration: none;
  }
}


@include keyframes(flash) {
   0%, 30%, 100%    { color: #000; background: $gray; } 
   15%              { color: #FFF; background: $blue; } 
} 

.flash { 
  @include animation-name(flash);
  @include animation-duration(600ms);
}
            
          
!
            
              $('.btn-dropdown').click (e) ->
  e.stopPropagation()
  $('#dropdown-menu').toggleClass 'open'
  $('#dropdown-menu li a').removeClass()
  
$('#dropdown-menu li a').click (e) ->
  $(this).addClass "flash"
  $('#dropdown-menu').removeClass 'open'
    
$('html').click ->
  $('#dropdown-menu').removeClass 'open'
    
            
          
!
999px
Loading ..................

Console