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="container">
  <button class="small"></button>
  
  <button class="small spinning-loader"></button>
  <button class="small active"></button>
</div>

<div class="container">
  <button class="normal primary"></button>  
  <button class="normal save"></button>
  <button class="normal edit"></button>
</div>
<div class="container">
  <button class="large"></button>
  
  <button class="large spinning-loader"></button>
  <button class="large active"></button>
</div>
              
            
!

CSS

              
                /**
Author: JH
**/

.container {
  text-align: center;
  padding-top: 50px;
}
/** Default tint **/
$tint-default: #E85757;
/** Transition speed, delay **/
$transition-delay: 0.25s;
/** Speed of the spinning loader (speed = 360deg) **/
$spinning-speed: 1s;
/** Bubble iteration count, 2 looks good imo **/
$bubble-bounces: 2;

/**
Creates a new button size, named by identifier.

@param $identifier Classidentifier of the new size
@param $width Width of button 
@param $height Height of button, also used for spinner
@param $fontSize, default 14px
**/
@mixin button-size($identifier, $width, $height, $fontSize: 14px) {
  button.#{$identifier} {
    height: $height;
    width: $width;
    font-size: $fontSize;
    
    &.spinning-loader {
      height: $height;
      width: $height;
    }
  }
}

/**
Creates a new button theme, named by identifier.

@param $identifier Classidentifier of the new theme
@param $color New buttons color
@param $label Only used for showcase purpose for codepen
**/
@mixin button-theme($identifier, $color, $label: 'Send') {
  button.#{$identifier} {
      border-color: $color;
      color: $color;
      &:hover {
        background-color: $color;
      }
      &:after {
        content: $label;
      }
      &.spinning-loader {
        border-color: rgba(0,0,0,.25);
        border-left-color: $color;
      }
      &.active {
        background: $color;
      }
  }
}

@include button-size(large, 200px, 60px, 16px);
@include button-size(normal, 150px, 50px);
@include button-size(small, 100px, 30px, 12px);

@include button-theme(primary, #57BDE8, 'Primary');
@include button-theme(save, #F7BD51, 'Save');
@include button-theme(edit, #C1E819, 'Edit');

button {
  display: inline-block;
  background: transparent;
  color: $tint-default;
  padding: 0;
  border: 2px solid $tint-default;
  border-radius: 40px;
  text-transform: uppercase;
  outline: 0;
  font: {
    family: 'Roboto', sans-serif;
    weight: bold;
  }
  letter-spacing: 2px;
  transition: all $transition-delay ease;
  width: 150px;
  height: 50px;
  cursor: pointer;
  &:hover {
    background-color: $tint-default;
    color: rgb(255, 255, 255);
  }
  &:active {
    letter-spacing: 1px;
  }
  &:after {
    content: 'Send';
    opacity: 1;
  }
}

.active {
  color: rgb(255, 255, 255) !important;
  background: $tint-default;
  &:after {
    font-family: 'FontAwesome';
    content: "\f00c" !important;
    opacity: 1;
  }
}

.bubble {
  animation: bubble $transition-delay $transition-delay ease $bubble-bounces;
}

@keyframes bubble {
  0% {
    transform: scale(1, 1);
  }
  50% {
    transform: scale(0.95, 0.95);
  }
  100% {
    transform: scale(1, 1);
  }
}

.spinning-loader {
  vertical-align: middle;
  border-radius: 50% !important;
  border: 2px solid rgba(0, 0, 0, .25);
  padding: 0;
  border-left-color: $tint-default;
  background: transparent;
  transform: rotate(0deg);
  color: rgb(255, 255, 255) !important;
  animation: spinning $spinning-speed $transition-delay linear infinite;
  &:after {
    content: '';
    opacity: 0;
  }
  &:hover {
    background-color: transparent !important;
  }
}

@keyframes spinning {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}
              
            
!

JS

              
                var msClickDelay    = 500;
var msSpinningTime  = 2000 + msClickDelay;
var msActive        = 2000;

$('button').click(function(ev){
  ev.preventDefault();
  
  var $button = $(this);
  
  setTimeout(function(){
    $button.addClass('spinning-loader');
  }, msClickDelay);
  
  setTimeout(function(){
    $button.removeClass('spinning-loader');
    $button.addClass('active');
  
    $button.addClass('bubble');  
    setTimeout(callback, msActive);
  }, msSpinningTime);
  
  function callback() {
     $button.removeClass('active');
     $button.removeClass('bubble');
  }
});
              
            
!
999px

Console