css Audio - Active file-generic CSS - Active Generic - Active HTML - Active JS - Active SVG - Active Text - Active file-generic Video - Active header Love html icon-new-collection icon-person icon-team numbered-list123 pop-out spinner split-screen star tv

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.

+ add another resource

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

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.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

            
              <div class="wrapper">
  <div class="header-wrap">
    <h1>3D Retro Buttons</h1>
  </div>
</div>

<br/><br/>

<div class='wrapper'>
  <div role='button' class='retro-btn'>
    <a class='btn'> 
      <span class='btn-inner'>
        <span class='content-wrapper'>
          <span class='btn-content'>
            <span class='btn-content-inner' label='Retro Button'>
            </span>
          </span>
        </span>
      </span>
    </a>
  </div>
</div>

<div style="display: inline-block; width: 50px"></div>

<div class="wrapper">
  <button class="loader-button">Loader</button>
</div>

<br/>

<div class='wrapper'>
  <div role='button' class='retro-btn lg primary'>
    <a class='btn'> 
      <span class='btn-inner'>
        <span class='content-wrapper'>
          <span class='btn-content'>
            <span class='btn-content-inner' label='Large'>
            </span>
          </span>
        </span>
      </span>
    </a>
  </div>
</div>

<div style="display: inline-block; width: 30px"></div>

<div class='wrapper'>
  <div role='button' class='retro-btn primary'>
    <a class='btn'> 
      <span class='btn-inner'>
        <span class='content-wrapper'>
          <span class='btn-content'>
            <span class='btn-content-inner' label='Medium'>
            </span>
          </span>
        </span>
      </span>
    </a>
  </div>
</div>

<div style="display: inline-block; width: 30px"></div>

<div class='wrapper'>
  <div role='button' class='retro-btn sm primary'>
    <a class='btn'> 
      <span class='btn-inner'>
        <span class='content-wrapper'>
          <span class='btn-content'>
            <span class='btn-content-inner' label='Small'>
            </span>
          </span>
        </span>
      </span>
    </a>
  </div>
</div>

<br />

<div class='wrapper'>
  <div role='button' class='retro-btn primary'>
    <a class='btn'> 
      <span class='btn-inner'>
        <span class='content-wrapper'>
          <span class='btn-content'>
            <span class='btn-content-inner' label='Primary'>
            </span>
          </span>
        </span>
      </span>
    </a>
  </div>
</div>

<div style="display: inline-block; width: 30px"></div>

<div class='wrapper'>
  <div role='button' class='retro-btn secondary'>
    <a class='btn'> 
      <span class='btn-inner'>
        <span class='content-wrapper'>
          <span class='btn-content'>
            <span class='btn-content-inner' label="Secondary">
            </span>
          </span>
        </span>
      </span>
    </a>
  </div>
</div>

<div style="display: inline-block; width: 30px"></div>

<div class='wrapper'>
  <div role='button' class='retro-btn danger'>
    <a class='btn'> 
      <span class='btn-inner'>
        <span class='content-wrapper'>
          <span class='btn-content'>
            <span class='btn-content-inner' label="Danger">
            </span>
          </span>
        </span>
      </span>
    </a>
  </div>
</div>

<br />

<div class='wrapper'>
  <div role='button' class='retro-btn warning'>
    <a class='btn'> 
      <span class='btn-inner'>
        <span class='content-wrapper'>
          <span class='btn-content'>
            <span class='btn-content-inner' label="Warning">
            </span>
          </span>
        </span>
      </span>
    </a>
  </div>
</div>

<div style="display: inline-block; width: 30px"></div>

<div class='wrapper'>
  <div role='button' class='retro-btn success'>
    <a class='btn'> 
      <span class='btn-inner'>
        <span class='content-wrapper'>
          <span class='btn-content'>
            <span class='btn-content-inner' label="Success">
            </span>
          </span>
        </span>
      </span>
    </a>
  </div>
</div>

<div style="display: inline-block; width: 30px"></div>

<div class='wrapper'>
  <div role='button' class='retro-btn info'>
    <a class='btn'> 
      <span class='btn-inner'>
        <span class='content-wrapper'>
          <span class='btn-content'>
            <span class='btn-content-inner' label="Info">
            </span>
          </span>
        </span>
      </span>
    </a>
  </div>
</div>

            
          
!
            
              *, :after, :before { 
  -moz-box-sizing: border-box;
  -webkit-box-sizing: border-box;
  box-sizing: border-box; 
  padding: 0;
  margin: 0;
}

body {
  color: #aaa;
  background-color: #2F2F2F;
  text-align: center;
  overflow-x: hidden;
}

#title {
  position: relative;
  margin: 70px auto 50px;
  font-size: 60px;
  font-family: 'Press Start 2P', cursive;
}

.wrapper {
  position: relative;
  display: inline-block;
  margin: 35px auto;
}

//
// ---Retro Header---
// 
.header-wrap {
  display: block;
  width: auto;
  height: auto;
  padding: 0;
  text-align: center;
  font-size: 25px;
  font-family: 'Press Start 2P', cursive;
  transform: perspective(200px) rotateX(10deg);
  letter-spacing: .1em;
  user-select: none;
  text-shadow: 
    0 -1px 0 #fff, 
    0 1px 0 #004d40, 
    0 2px 0 #00483B, 
    0 3px 0 #004639, 
    0 4px 0 #004336, 
    0 5px 0 #004134, 
    0 6px 0 #003F32, 
    0 7px 0 #003D30, 
    0 8px 0 #003A2D, 
    0 9px 0 #00382B, 
    0 10px 0 #003528, 
    0 11px 0 #003225, 
    0 12px 0 #002F22, 
    0 13px 0 #002B1E, 
    0 14px 0 #00281C, 
    0 15px 0 #001F13, 
    0 22px 30px rgba(0,0,0, 0.9),
    0 22px 30px rgba(0, 0, 0, 0.9),
    0 22px 15px rgba(0, 0, 0, 0.9),
    0 11px 15px rgba(0, 0, 0, 0.9),
    0 15px 20px rgba(0, 0, 0, 0.9),
    0 15px 11px rgba(0, 0, 0, 0.9),
    0 16px 11px rgba(0, 0, 0, 0.9);

  transition: text-shadow .3s ease .3s, 
    transform .3s ease .3s,
    letter-spacing .3s ease .3s;

  &:hover {
    transition: text-shadow .33s ease, 
      transform .3s ease,
      letter-spacing .3s ease;
    text-shadow: 0 0 0 #004134,
      0 1px 0 #00483B,
      0 2px 0 #003528,
      0 3px 3px rgba(0, 0, 0, 0.9);
    transform: translate(0px, 15px) 
      perspective(200px) 
      rotateX(10deg);
    letter-spacing: .125em;
  }
}

//
// ---Retro Button---
//
.retro-btn {
  text-transform: uppercase;
  background: 0 0;
  
  &.lg {
    .btn {
      width: 294px;
      height: 54px;
      font-size: 17px;
      line-height: 50px;
      
      .btn-inner .content-wrapper .btn-content .btn-content-inner:before {
        padding-top: 0;
        letter-spacing: .15em;
      }
    }
  }
  &.sm {
    .btn {
      width: 165px;
      height: 37px;
      font-size: 10.5px;
      line-height: 32.5px;

      .btn-inner .content-wrapper .btn-content .btn-content-inner:before {
        padding-top: 0;
      }
    }
  }
  
  &.primary {
    .btn .btn-inner .content-wrapper {
      &:before {
        background-color: #051D41;
      }
      .btn-content {
        background-color: #0d47a1;
      }
    }
  }
  &.secondary {
    .btn .btn-inner .content-wrapper {
      &:before {
        background-color: #263238;
      }
      .btn-content {
        background-color: #37474F;
      }
    }
  }
  &.danger {
    .btn .btn-inner .content-wrapper {
      &:before {
        background-color: #590000;
      }
      .btn-content {
        background-color: #CC0000;
      }
    }
  }
  &.warning {
    .btn .btn-inner .content-wrapper {
      &:before {
        background-color: #6A3800;
      }
      .btn-content {
        background-color: #FF8800;
      }
    }
  }
  &.success {
    .btn .btn-inner .content-wrapper {
      &:before {
        background-color: #00481F;
      }
      .btn-content {
        background-color: #009A3E;
      }
    }
  }
  &.info {
    .btn .btn-inner .content-wrapper {
      &:before {
        background-color: #164E62;
      }
      .btn-content {
        background-color: #33b5e5;
      }
    }
  }

  .btn {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-box-sizing: border-box;
    box-sizing: border-box;
    display: inline-block;
    vertical-align: middle;
    padding-top: 3px;
    position: relative;
    cursor: pointer;
    font-weight: 600;
    font-family: inherit;
    font-style: normal;
    letter-spacing: 0;
    text-rendering: auto;
    text-decoration: none;
    text-align: center;
    -webkit-transition: opacity .1s ease-out;
    transition: opacity .1s ease-out;
    z-index: 5;
    -webkit-font-smoothing: antialiased;

    // size
    width: 240px;
    height: 46px;
    font-size: 12px;
    line-height: 24px;
    
    background-color: transparent;
    text-decoration-color: initial;
    border-color: initial;
    -webkit-tap-highlight-color: transparent;

    &, &:focus {
      outline-color: 0;
      outline-style: none;
      outline-width: 0;
    }

    &:hover {
      .btn-content-inner:before {
        background-color: rgba(13,13,13,.1);
      }
    }

    &:before {
      content: " ";
      background-color: rgba(13, 13, 13, .3);
      width: calc(100% - 2px);
      height: calc(100% - 4px);
      bottom: -1px;
      left: 1px;
      position: absolute;
      border-radius: 3px;
      z-index: 1;
      -webkit-transition: background .12s ease-out, -webkit-transform .12s ease-out;
      transition: background .12s ease-out, -webkit-transform .12s ease-out;
      transition: transform .12s ease-out, background .12s ease-out;
      transition: transform .12s ease-out, background .12s ease-out, -webkit-transform .12s ease-out;
    }

    &.btn-left {
      &:before {
        -webkit-transform: skewY(1deg) translate3d(0,-.5px,0);
        transform: skewY(1deg) translate3d(0,-.5px,0);
      }

      .btn-content {
        -webkit-transform: skewY(-1deg);
        transform: skewY(-1deg);
      }
    }

    &.btn-right {
      &:before {
        -webkit-transform: skewY(-1deg) translate3d(0,-.5px,0);
        transform: skewY(-1deg) translate3d(0,-.5px,0);
      }

      .btn-content {
        -webkit-transform: skewY(1deg);
        transform: skewY(1deg);
      }
    }

    &.btn-center {
      &:before {
        -webkit-transform: translate3d(0,-1px,0);
        transform: translate3d(0,-1px,0);
      }

      .btn-content {
        -webkit-transform: translate3d(0,1px,0);
        transform: translate3d(0,1px,0);
      }
    }

    &.btn-active {
      .btn-inner .content-wrapper .btn-content {
        -webkit-transition: background .12s ease-out,color .12s ease-out,-webkit-transform .12s ease-out;
        transition: background .12s ease-out,color .12s ease-out,-webkit-transform .12s ease-out;
        transition: transform .12s ease-out,background .12s ease-out,color .12s ease-out;
        transition: transform .12s ease-out,background .12s ease-out,color .12s ease-out,-webkit-transform .12s ease-out;
        -webkit-transform: translate3d(0,2px,0);
        transform: translate3d(0,2px,0);

        .btn-content-inner {
          opacity: .1;
        }
      }

      &:before {
        -webkit-transform: translate3d(0,-3px,0);
        transform: translate3d(0,-3px,0);
      }
    }

    .btn-inner {
      display: block;
      height: 100%;

      .content-wrapper {
        position: relative;
        font-family: inherit;
        display: -webkit-box;
        display: -ms-flexbox;
        display: flex;
        -webkit-box-align: stretch;
        -ms-flex-align: stretch;
        align-items: stretch;
        width: 100%;
        height: calc(100% - 3px);
        margin-top: -3px;

        &:after, &:before, 
        & .btn-content:after, 
        & .btn-content:before, 
        & .btn-content .btn-content-inner:before {
          display: block;
          position: absolute;
          width: 100%;
          height: 100%;
          top: 0;
          left: 0;
        }

        &:before {
          background-image: initial;
          background-color: #004d40;

          content: " ";
          border-radius: 3px;
          top: auto;
          bottom: -3px;
          z-index: 1;
          -webkit-transition: background .185s ease-out, -webkit-transform .185s ease-out;
          transition: background .185s ease-out, -webkit-transform .185s ease-out;
          transition: transform .185s ease-out, background .185s ease-out;
          transition: transform .185s ease-out, background .185s ease-out, -webkit-transform .185s ease-out;
        }

        &:after {
          background-color: rgba(13, 13, 13, 0.15);

          content: " ";
          border-radius: 3px;
          z-index: 3;
          width: 0;
          top: 2px;
        }

        .btn-content {
          background-image: initial;
          background-color: #26a69a;
          color: #ebf1f8;

          position: relative;
          display: -webkit-box;
          display: -ms-flexbox;
          display: flex;
          -webkit-box-flex: 1;
          -ms-flex: 1;
          flex: 1;
          -webkit-box-align: center;
          -ms-flex-align: center;
          align-items: center;
          -webkit-box-pack: center;
          -ms-flex-pack: center;
          justify-content: center;
          border-radius: 3px;
          text-indent: 0;
          z-index: 3;
          overflow: hidden;
          padding: 0 16px;
          -webkit-transition: border .185s ease-out,background .185s ease-out,color .185s ease-out,-webkit-transform .185s ease-out;
          transition: border .185s ease-out,background .185s ease-out,color .185s ease-out,-webkit-transform .185s ease-out;
          transition: border .185s ease-out,transform .185s ease-out,background .185s ease-out,color .185s ease-out;
          transition: border .185s ease-out,transform .185s ease-out,background .185s ease-out,color .185s ease-out,-webkit-transform .185s ease-out;
          
          &:before, &:after {
            display: -webkit-box;
            display: -ms-flexbox;
            display: flex;
            -webkit-box-align: center;
            -ms-flex-align: center;
            align-items: center;
            -webkit-box-pack: center;
            -ms-flex-pack: center;
            justify-content: center;
            color: rgba(255,255,255,.8);
            opacity: 0;
            -webkit-transition: opacity .1125s ease-out .05s, -webkit-transform .185s ease-out .05s;
            transition: opacity .1125s ease-out .05s, -webkit-transform .185s ease-out .05s;
            transition: transform .185s ease-out .05s, opacity .1125s ease-out .05s;
            transition: transform .185s ease-out .05s, opacity .1125s ease-out .05s, -webkit-transform .185s ease-out .05s;
          }

          &:before {
            content: " ";
            -webkit-transform: translate3d(0,50%,0);
            transform: translate3d(0,50%,0);
          }

          &:after {
            content: " ";
            -webkit-transform: translate3d(0,-50%,0);
            transform: translate3d(0,-50%,0);
          }


          .btn-content-inner {
            display: block;
            -webkit-transition: opacity 75ms ease-out .1125s;
            transition: opacity 75ms ease-out .1125s;

            &:before {
              content: attr(label);
              padding-top: 9.5px;
              font-size: .8em;
              font-family: 'Press Start 2P', cursive;
              letter-spacing: .06em;
              -webkit-transition: opacity .3s ease-out, background-color .1125s ease-in;
              transition: opacity .3s ease-out, background-color .1125s ease-in;
              opacity: 1;
              z-index: -1;
            }
          }
        }
      }
    }
  }
}


//
// Retro Submit Button
//

.loader-button {
	position: relative;
	display: inline-block;
	padding: 0 60px;
	outline: none;
	border: none;
	background: #1d9650;
	color: #fff;
	text-transform: uppercase;
	letter-spacing: 1px;
	font-size: 1em;
  font-family: 'Press Start 2P', cursive;
  transform: perspective(400px) rotateX(6deg);
	line-height: 4;
  padding: 0;
	overflow: visible;
	-webkit-backface-visibility: hidden;
	backface-visibility: hidden;
  cursor: pointer;
  border-radius: 6px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, .7);
  transition: color .1s ease-in .1s, transform .185s ease-in, box-shadow .15s ease-in;
  
  &.btn-active {
    color: #148544;
    box-shadow: 0 3px 2px rgba(0, 0, 0, .3);

    .content {
      transform: translateY(-3px);
    }
  }
  
  &.state-loading .content {
    -webkit-transform: translateY(-12px);
    transform: translateY(-12px);
  }
  
  &[disabled],
  &[disabled].state-loading {
    cursor: default;
  }
  
  &.state-success .content:before,
  &.state-error .content:after {
    opacity: 1;
  }
  
  .content {
    position: relative;
    display: block;
    z-index: 10;
    padding: 0 60px;
    background: #1d9650;
    transform: translateY(-6px);
    -webkit-transition: -webkit-transform 0.2s;
    transition: transform 0.2s;
    border-radius: 4px;
    
    &:before,
    &:after  {
      position: absolute;
      right: 20px;
      color: #fff;
      opacity: 0;
      -webkit-transition: opacity 0.3s 0.3s;
      transition: opacity 0.3s 0.3s;
    }
    
    &:before {
      content: "✔";
      font-size: 25.5px;
      top: -22.9px;
      right: 30px;
      transform: perspective(400px) rotateX(39deg);
    }
    
    &:after {
      content: "✖";
      font-size: 25.5px;
      top: -22.9px;
      right: 30px;
      transform: perspective(400px) rotateX(39deg);
    }
  }
  
  .progress {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #0B562B;
    border-radius: 4px;
  }
  
  .progress-inner {
    position: absolute;
    top: 0;
    left: 0;
    width: 0;
    height: 100%;
    background: linear-gradient(0.25turn, #07351B, #062C16); // #062C16;
    border-radius: 4px;
    -webkit-transition: width 0.3s, opacity 0.3s;
    transition: width 0.3s, opacity 0.3s;
  }
}

.notransition {
	-webkit-transition: none !important;
	transition: none !important;
}

            
          
!
            
              //
// ---Retro Button---
//
var buttons = document.querySelectorAll('.btn');

for(var i = 0; i < buttons.length; i++) {
  // Click
  buttons[i].addEventListener('mousedown', function() {
    this.classList.add('btn-active');
  });
  buttons[i].addEventListener('mouseup', function() {
    this.classList.remove('btn-active');
  });

  // Hover
  buttons[i].addEventListener('mouseleave', function() {
    this.classList.remove('btn-center', 'btn-right', 'btn-left', 'btn-active');
  });

  buttons[i].addEventListener("mousemove", function(e) {
    var leftOffset = this.getBoundingClientRect().left;
    var btnWidth = this.offsetWidth;
    var myPosX = e.pageX;
    var newClass = "";
    // if on left 1/3 width of btn
    if(myPosX < (leftOffset + .3 * btnWidth) ) {
      newClass = 'btn-left'
    } else {
      // if on right 1/3 width of btn
      if(myPosX > (leftOffset + .65 * btnWidth) ) {
        newClass = 'btn-right';
      } else {
        newClass = 'btn-center';
      }
    }
    // remove prev class
    var clearedClassList = this.className.replace(/btn-center|btn-right|btn-left/gi, "").trim();
    this.className = clearedClassList + " " + newClass;
  });
}


//
// ---Retro Submit Button---
//
var pButton = document.querySelector('.loader-button');

// Click
pButton.addEventListener('mousedown', function() {
  this.classList.add('btn-active');
});
pButton.addEventListener('mouseup', function() {
  this.classList.remove('btn-active');
});


// Classie Helper Functions
// https://github.com/desandro/classie

function classReg( className ) {
  return new RegExp("(^|\\s+)" + className + "(\\s+|$)");
}

// classList support for class management
// altho to be fair, the api sucks because it won't accept multiple classes at once
var hasClass, addClass, removeClass;

if ( 'classList' in document.documentElement ) {
  hasClass = function( elem, c ) {
    return elem.classList.contains( c );
  };
  addClass = function( elem, c ) {
    elem.classList.add( c );
  };
  removeClass = function( elem, c ) {
    elem.classList.remove( c );
  };
}
else {
  hasClass = function( elem, c ) {
    return classReg( c ).test( elem.className );
  };
  addClass = function( elem, c ) {
    if ( !hasClass( elem, c ) ) {
      elem.className = elem.className + ' ' + c;
    }
  };
  removeClass = function( elem, c ) {
    elem.className = elem.className.replace( classReg( c ), ' ' );
  };
}

function toggleClass( elem, c ) {
  var fn = hasClass( elem, c ) ? removeClass : addClass;
  fn( elem, c );
}

var classie = {
  // full names
  hasClass: hasClass,
  addClass: addClass,
  removeClass: removeClass,
  toggleClass: toggleClass,
  // short names
  has: hasClass,
  add: addClass,
  remove: removeClass,
  toggle: toggleClass
};

// transport
if ( typeof define === 'function' && define.amd ) {
  // AMD
  define( classie );
} else {
  // browser global
  window.classie = classie;
}


// Loader Progress Functionality

function extend( a, b ) {
  for( var key in b ) { 
    if( b.hasOwnProperty( key ) ) {
      a[key] = b[key];
    }
  }
  return a;
}

function LoaderButton( el, options ) {
  this.button = el;
  this.options = extend( {}, this.options );
  extend( this.options, options );
  this._init();
}

LoaderButton.prototype.options = {
  statusTime : 1500
};

LoaderButton.prototype._init = function() {
  this._create();
  this._initEvents();
};

LoaderButton.prototype._create = function() {
  var textEl = document.createElement( 'span' );
  textEl.className = 'content';
  textEl.innerHTML = this.button.innerHTML;
  var progressEl = document.createElement( 'span' );
  progressEl.className = 'progress';
  
  var progressInnerEl = document.createElement( 'span' );
  progressInnerEl.className = 'progress-inner';
  progressEl.appendChild( progressInnerEl );
  
  this.button.innerHTML = '';

  this.button.appendChild( textEl );
  this.button.appendChild( progressEl );

  // element for progress bar
  this.progress = progressInnerEl;

  this.progressProp = 'width';
  this._enable();
};

LoaderButton.prototype._setProgress = function( val ) {
  this.progress.style[ this.progressProp ] = 100 * val + '%';
};

LoaderButton.prototype._initEvents = function() {
  var self = this;
  this.button.addEventListener( 'click', function() {
    // disable button
    self.button.setAttribute( 'disabled', '' );
    // add class state-loading to button
    classie.remove( self.progress, 'notransition' );
    classie.add( this, 'state-loading' );

    setTimeout( function() {
      if( typeof self.options.callback === 'function' ) {
        self.options.callback( self );
      }
      else {
        self._setProgress( 1 );
        var onEndTransFn = function( ev ) {
          if( ev.propertyName !== self.progressProp ) { 
            return; 
          }
          this.removeEventListener( 'transitionend', onEndTransFn );
          self._stop();
        };

        self.progress.addEventListener( 'transitionend', onEndTransFn );
      }
    }, 
    200 ); // 200ms timeout
  } );
};

LoaderButton.prototype._stop = function( status ) {
  var self = this;

  setTimeout( function() {
    // fade out progress bar
    self.progress.style.opacity = 0;
    var onEndTransFn = function( ev ) {
      if( ev.propertyName !== 'opacity' ) return;
      this.removeEventListener( 'transitionend', onEndTransFn );
      classie.add( self.progress, 'notransition' );
      self.progress.style[ self.progressProp ] = '0%';
      self.progress.style.opacity = 1;
    };
    
    self.progress.addEventListener( 'transitionend', onEndTransFn );
    
    // add class state-success to button
    if( typeof status === 'number' ) {
      var statusClass = status >= 0 ? 'state-success' : 'state-error';
      classie.add( self.button, statusClass );
      // after options.statusTime remove status icon
      setTimeout( function() {
        classie.remove( self.button, statusClass );
        self._enable();
      }, self.options.statusTime );
    }
    else {
      self._enable();
    }

    // remove class state-loading from the button
    classie.remove( self.button, 'state-loading' );
  }, 100 );
};

// enable button
LoaderButton.prototype._enable = function() {
  this.button.removeAttribute( 'disabled' );
}

// add to global namespace
window.LoaderButton = LoaderButton;


// Initialize Submit Button

[].slice.call( document.querySelectorAll( 'button.loader-button' ) ).forEach( function( bttn ) {
  new LoaderButton( bttn, {
    callback : function( instance ) {
      var progress = 0,
          interval = setInterval( function() {
            progress = Math.min( progress + Math.random() * 0.1, 1 );
            instance._setProgress( progress );

            if( progress === 1 ) {
              instance._stop(1);
              clearInterval( interval );
            }
          }, 200 ); // 200ms interval
    }
  } );
} );
            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.
Loading ..................

Console