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

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

              
                <article class="examples">

	<div class="intro">
		<h1>Ladda</h1>
		<p>
			A UI concept which merges loading indicators into the action that invoked them. Primarily intended for use with forms where 
			it gives users immediate feedback upon submit rather than leaving them wondering while the browser does its thing. For a 
      real-world example, check out any of the forms on <a href="http://slid.es" target="_blank">slid.es</a>. Also available at <a href="https://github.com/hakimel/Ladda" target="_blank">github.com/hakimel/Ladda</a>.
		</p>
	</div>
	
	<section>
		<h3>expand-left</h3>
		<button class="ladda-button green expand-left"><span class="label">Submit</span> <span class="spinner"></span></button>
	</section>

	<section>
		<h3>expand-right</h3>
		<button class="ladda-button green expand-right"><span class="label">Submit</span> <span class="spinner"></span></button>
	</section>
  
	<section>
		<h3>expand-up</h3>
		<button class="ladda-button green expand-up"><span class="label">Submit</span> <span class="spinner"></span></button>
	</section>

	<section>
		<h3>expand-down</h3>
		<button class="ladda-button green expand-down"><span class="label">Submit</span> <span class="spinner"></span></button>
	</section>


	<section>
		<h3>contract</h3>
		<button class="ladda-button orange contract"><span class="label">Submit</span> <span class="spinner"></span></button>
	</section>

	<section>
		<h3>contract-overlay</h3>
		<button class="ladda-button orange contract-overlay" style="z-index: 10;"><span class="label">Submit</span> <span class="spinner"></span></button>
	</section>

	<section>
		<h3>zoom-in</h3>
		<button class="ladda-button orange zoom-in"><span class="label">Submit</span> <span class="spinner"></span></button>
	</section>

	<section>
		<h3>zoom-out</h3>
		<button class="ladda-button orange zoom-out"><span class="label">Submit</span> <span class="spinner"></span></button>
	</section>


	<section>
		<h3>slide-left</h3>
		<button class="ladda-button blue slide-left"><span class="label">Submit</span> <span class="spinner"></span></button>
	</section>

	<section>
		<h3>slide-right</h3>
		<button class="ladda-button blue slide-right"><span class="label">Submit</span> <span class="spinner"></span></button>
	</section>

	<section>
		<h3>slide-up</h3>
		<button class="ladda-button blue slide-up"><span class="label">Submit</span> <span class="spinner"></span></button>
	</section>

	<section>
		<h3>slide-down</h3>
		<button class="ladda-button blue slide-down"><span class="label">Submit</span> <span class="spinner"></span></button>
	</section>

	<small class="outro">by <a href="http://hakim.se">Hakim El Hattab</a> / <a href="https://twitter.com/hakimel">@hakimel</a></small>

</article>
              
            
!

CSS

              
                body {
	background: #f5f5f5;
	font-family: monospace;
	font-size: 14px;
	color: #333333;
}

.examples {
	max-width: 670px;
	margin: 2em auto;
	padding: 4em;
	background: #fff;
	text-align: center
}
	.examples .intro {
		margin-bottom: 3em;
		line-height: 1.4em;
		font-size: 16px;
		text-align: left;
	}
		.examples .intro h1 {
			margin-top: 0;
			font-size: 18px;
		}

	.examples .outro {
		display: block;
		text-align: right;
		margin-top: 3em;
	}
	.examples section {
		display: inline-block;
		width: 24%;
		min-width: 160px;
		margin-bottom: 2em;
		text-align: center;
		vertical-align: top;
	}
	.examples section h3 {
		color: #bbb;
		font-weight: normal;
	}


/*************************************
 * BUTTON BASE
 */

.ladda-button {
	position: relative;
	background: none;
	border: 0;
	padding: 0.8em 1em;
	font-size: 1.3em;
	cursor: pointer;
  outline: 0;

	-webkit-appearance: none;
	-webkit-font-smoothing: antialiased;
	-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}
	.ladda-button[data-loading] {
		cursor: default;
	}

/* Green button */
.ladda-button.green {
	background: #2aca76;
	color: #fff;
	border-radius: 2px;
	border: 1px solid transparent;
}
	.ladda-button.green:hover {
		border-color: rgba( 0, 0, 0, 0.07 );
		background-color: #2fe688;
	}
	.ladda-button.green[data-loading] {
		border-color: rgba( 0, 0, 0, 0.07 );
		background-color: #999;
	}

/* Blue button */
.ladda-button.blue {
	background: #53b5e6;
	color: #fff;
	border-radius: 2px;
	border: 1px solid transparent;
}
	.ladda-button.blue:hover {
		border-color: rgba( 0, 0, 0, 0.07 );
		background-color: #58c2f8;
	}
	.ladda-button.blue[data-loading] {
		border-color: rgba( 0, 0, 0, 0.07 );
		background-color: #999;
	}

/* Orange button */
.ladda-button.orange {
	background: #ea8557;
	color: #fff;
	border-radius: 2px;
	border: 1px solid transparent;
}
	.ladda-button.orange:hover {
		border-color: rgba( 0, 0, 0, 0.07 );
		background-color: #ffa96c;
	}
	.ladda-button.orange[data-loading] {
		border-color: rgba( 0, 0, 0, 0.07 );
		background-color: #999;
	}


/* Spinner animation */
.ladda-button .spinner {
	position: absolute;
	width: 32px;
	height: 32px;
	top: 50%;
	margin-top: -16px;
	opacity: 0;
	background-image: url( data:image/gif;base64,R0lGODlhIAAgAPMAAJmZmf///6+vr8nJybW1tcDAwOjo6Nvb26ioqKOjo7Ozs/Ly8vz8/AAAAAAAAAAAACH/C05FVFNDQVBFMi4wAwEAAAAh/hpDcmVhdGVkIHdpdGggYWpheGxvYWQuaW5mbwAh+QQJCgAAACwAAAAAIAAgAAAE5xDISWlhperN52JLhSSdRgwVo1ICQZRUsiwHpTJT4iowNS8vyW2icCF6k8HMMBkCEDskxTBDAZwuAkkqIfxIQyhBQBFvAQSDITM5VDW6XNE4KagNh6Bgwe60smQUB3d4Rz1ZBApnFASDd0hihh12BkE9kjAJVlycXIg7CQIFA6SlnJ87paqbSKiKoqusnbMdmDC2tXQlkUhziYtyWTxIfy6BE8WJt5YJvpJivxNa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1cRdCQ8iEIfzFVTzLdRAmZX3I2SfYIDMaAFdTESJeaEDAIMxYFqrOUaNW4E4ObYcCXaiBVEgULe0NJaxxtYksjh2NLkZISgDgJhHthkpU4mW6blRiYmZOlh4JWkDqILwUGBnE6TYEbCgevr0N1gH4At7gHiRpFaLNrrq8HNgAJA70AWxQIH1+vsYMDAzZQPC9VCNkDWUhGkuE5PxJNwiUK4UfLzOlD4WvzAHaoG9nxPi5d+jYUqfAhhykOFwJWiAAAIfkECQoAAAAsAAAAACAAIAAABPAQyElpUqnqzaciSoVkXVUMFaFSwlpOCcMYlErAavhOMnNLNo8KsZsMZItJEIDIFSkLGQoQTNhIsFehRww2CQLKF0tYGKYSg+ygsZIuNqJksKgbfgIGepNo2cIUB3V1B3IvNiBYNQaDSTtfhhx0CwVPI0UJe0+bm4g5VgcGoqOcnjmjqDSdnhgEoamcsZuXO1aWQy8KAwOAuTYYGwi7w5h+Kr0SJ8MFihpNbx+4Erq7BYBuzsdiH1jCAzoSfl0rVirNbRXlBBlLX+BP0XJLAPGzTkAuAOqb0WT5AH7OcdCm5B8TgRwSRKIHQtaLCwg1RAAAOwAAAAAAAAAAAA==);
}


/*************************************
 * EASING
 */

.ladda-button,
.ladda-button .spinner,
.ladda-button .label {
	-webkit-transition: 0.3s cubic-bezier(0.175, 0.885, 0.320, 1.275) all;
	   -moz-transition: 0.3s cubic-bezier(0.175, 0.885, 0.320, 1.275) all;
	    -ms-transition: 0.3s cubic-bezier(0.175, 0.885, 0.320, 1.275) all;
	        transition: 0.3s cubic-bezier(0.175, 0.885, 0.320, 1.275) all;
}

.ladda-button.zoom-in,
.ladda-button.zoom-in .spinner,
.ladda-button.zoom-in .label,
.ladda-button.zoom-out,
.ladda-button.zoom-out .spinner,
.ladda-button.zoom-out .label {
	-webkit-transition: 0.3s ease all;
	   -moz-transition: 0.3s ease all;
	    -ms-transition: 0.3s ease all;
	        transition: 0.3s ease all;
}


/*************************************
 * EXPAND LEFT
 */

.ladda-button.expand-right .spinner {
	right: 0.8em;
}

.ladda-button.expand-right[data-loading] {
	padding-right: 56px;
}
	.ladda-button.expand-right[data-loading] .spinner {
		opacity: 1;
	}


/*************************************
 * EXPAND RIGHT
 */

.ladda-button.expand-left .spinner {
	left: 0.8em;
}

.ladda-button.expand-left[data-loading] {
	padding-left: 56px;
}
	.ladda-button.expand-left[data-loading] .spinner {
		opacity: 1;
	}


/*************************************
 * EXPAND UP
 */

.ladda-button.expand-up {
	overflow: hidden;
}
	.ladda-button.expand-up .spinner {
		top: -32px;
		left: 50%;
		margin-left: -16px;
	}

.ladda-button.expand-up[data-loading] {
	padding-top: 3em;
}
	.ladda-button.expand-up[data-loading] .spinner {
		opacity: 1;
		top: 0.8em;
		margin-top: 0;
	}


/*************************************
 * EXPAND DOWN
 */

.ladda-button.expand-down {
	overflow: hidden;
}
	.ladda-button.expand-down .spinner {
		top: 3.3em;
		left: 50%;
		margin-left: -16px;
	}

.ladda-button.expand-down[data-loading] {
	padding-bottom: 3em;
}
	.ladda-button.expand-down[data-loading] .spinner {
		opacity: 1;
	}


/*************************************
 * SLIDE LEFT
 */
.ladda-button.slide-left {
	overflow: hidden;
}
	.ladda-button.slide-left .label {
		position: relative;
	}
	.ladda-button.slide-left .spinner {
		left: 100%;
		margin-left: -16px;
	}

.ladda-button.slide-left[data-loading] .label {
	opacity: 0;
	left: -100%;
}
.ladda-button.slide-left[data-loading] .spinner {
	opacity: 1;
	left: 50%;
}


/*************************************
 * SLIDE RIGHT
 */
.ladda-button.slide-right {
	overflow: hidden;
}
	.ladda-button.slide-right .label {
		position: relative;
	}
	.ladda-button.slide-right .spinner {
		right: 100%;
		margin-left: -16px;
	}

.ladda-button.slide-right[data-loading] .label {
	opacity: 0;
	left: 100%;
}
.ladda-button.slide-right[data-loading] .spinner {
	opacity: 1;
	left: 50%;
}


/*************************************
 * SLIDE UP
 */
.ladda-button.slide-up {
	overflow: hidden;
}
	.ladda-button.slide-up .label {
		position: relative;
	}
	.ladda-button.slide-up .spinner {
		left: 50%;
		margin-left: -16px;
		margin-top: 1em;
	}

.ladda-button.slide-up[data-loading] .label {
	opacity: 0;
	top: -1em;
}
.ladda-button.slide-up[data-loading] .spinner {
	opacity: 1;
	margin-top: -16px;
}


/*************************************
 * SLIDE DOWN
 */
.ladda-button.slide-down {
	overflow: hidden;
}
	.ladda-button.slide-down .label {
		position: relative;
	}
	.ladda-button.slide-down .spinner {
		left: 50%;
		margin-left: -16px;
		margin-top: -2em;
	}

.ladda-button.slide-down[data-loading] .label {
	opacity: 0;
	top: 1em;
}
.ladda-button.slide-down[data-loading] .spinner {
	opacity: 1;
	margin-top: -16px;
}


/*************************************
 * ZOOM-OUT
 */

.ladda-button.zoom-out {
	overflow: hidden;
}
	.ladda-button.zoom-out .spinner {
		left: 50%;
		margin-left: -16px;

		-webkit-transform: scale( 2.5 );
		   -moz-transform: scale( 2.5 );
		    -ms-transform: scale( 2.5 );
		        transform: scale( 2.5 );
	}
	.ladda-button.zoom-out .label {
		position: relative;
		display: inline-block;
	}

.ladda-button.zoom-out[data-loading] .label {
	opacity: 0;

	-webkit-transform: scale( 0.5 );
	   -moz-transform: scale( 0.5 );
	    -ms-transform: scale( 0.5 );
	        transform: scale( 0.5 );
}
.ladda-button.zoom-out[data-loading] .spinner {
	opacity: 1;

	-webkit-transform: none;
	   -moz-transform: none;
	    -ms-transform: none;
	        transform: none;
}


/*************************************
 * ZOOM-IN
 */

.ladda-button.zoom-in {
	overflow: hidden;
}
	.ladda-button.zoom-in .spinner {
		left: 50%;
		margin-left: -16px;

		-webkit-transform: scale( 0.2 );
		   -moz-transform: scale( 0.2 );
		    -ms-transform: scale( 0.2 );
		        transform: scale( 0.2 );
	}
	.ladda-button.zoom-in .label {
		position: relative;
		display: inline-block;
	}

.ladda-button.zoom-in[data-loading] .label {
	opacity: 0;

	-webkit-transform: scale( 2.2 );
	   -moz-transform: scale( 2.2 );
	    -ms-transform: scale( 2.2 );
	        transform: scale( 2.2 );
}
.ladda-button.zoom-in[data-loading] .spinner {
	opacity: 1;

	-webkit-transform: none;
	   -moz-transform: none;
	    -ms-transform: none;
	        transform: none;
}


/*************************************
 * CONTRACt
 */

.ladda-button.contract {
	overflow: hidden;
	width: 100px;
}
	.ladda-button.contract .spinner {
		left: 50%;
		margin-left: -16px;
	}

.ladda-button.contract[data-loading] {
	border-radius: 50%;
	width: 52px;
}
	.ladda-button.contract[data-loading] .label {
		opacity: 0;
	}
	.ladda-button.contract[data-loading] .spinner {
		opacity: 1;
	}



/*************************************
 * OVERLAY
 */

.ladda-button.contract-overlay {
	overflow: hidden;
	width: 100px;

	box-shadow: 0px 0px 0px 3000px rgba(0,0,0,0);
}
	.ladda-button.contract-overlay .spinner {
		left: 50%;
		margin-left: -16px;
	}

.ladda-button.contract-overlay[data-loading] {
	border-radius: 50%;
	width: 52px;

	/*outline: 10000px solid rgba( 0, 0, 0, 0.5 );*/
	box-shadow: 0px 0px 0px 3000px rgba(0,0,0,0.8);
}
	.ladda-button.contract-overlay[data-loading] .label {
		opacity: 0;
	}
	.ladda-button.contract-overlay[data-loading] .spinner {
		opacity: 1;
	}











              
            
!

JS

              
                var buttons = document.querySelectorAll( '.ladda-button' );

Array.prototype.slice.call( buttons ).forEach( function( button ) {

	var resetTimeout;

	button.addEventListener( 'click', function() {
		
		if( typeof button.getAttribute( 'data-loading' ) === 'string' ) {
			button.removeAttribute( 'data-loading' );
		}
		else {
			button.setAttribute( 'data-loading', '' );
		}

		clearTimeout( resetTimeout );
		resetTimeout = setTimeout( function() {
			button.removeAttribute( 'data-loading' );			
		}, 2000 );

	}, false );

} );
              
            
!
999px

Console