"Buttons with Built-in Loading Indicators"
Bootstrap 3.1.0 Snippet by ASDAFF

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<link href="//netdna.bootstrapcdn.com/bootstrap/3.1.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css">
<script src="//netdna.bootstrapcdn.com/bootstrap/3.1.0/js/bootstrap.min.js"></script>
<script src="//code.jquery.com/jquery-1.11.1.min.js"></script>
<!------ Include the above in your HEAD tag ---------->
<!-- SUBMITTED as a Feature: March 1, 2014 - 12:45am -->
<div class="container">
<div class="row">
<br>
<h3>Mr. M.'s Buttons with Built-in Loading Indicators<small> - bootsnipp.com style</small></h3>
<p> Original Ladda UI concept by
<a href="http://hakim.se">Hakim El Hattab</a>
<a href="http://twitter.com/hakimel">@hakimel</a>
examples adapted to work with Bootstrap 3 by
<a href="http://twitter.com/msurguy" target="_blank">@msurguy</a>
</p>
<blockquote>
Sample of "Save snippet" button, same behavior as bootsnipp.com.
<br><br>
<p>
<button class="btn btn-primary ladda-button" data-style="expand-right">
<span class="ladda-label">Сохранить сниппет</span>
</button>
</p>
</blockquote>
</div> <!-- /.row -->
</div> <!-- /.container -->
<div class="container">
<div class="row">
<div class="col-md-6 col-md-offset-3 text-center">
<hr>
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/* ladda.min.css */
/*
* Ladda
* http://lab.hakim.se/ladda
* MIT licensed
*
* Copyright (C) 2013 Hakim El Hattab, http://hakim.se
*/.ladda-button {
position: relative
}
.ladda-button .ladda-spinner {
position: absolute;
z-index: 2;
display: inline-block;
width: 32px;
height: 32px;
top: 50%;
margin-top: -16px;
opacity: 0;
pointer-events: none
}
.ladda-button .ladda-label {
position: relative;
z-index: 3
}
.ladda-button .ladda-progress {
position: absolute;
width: 0;
height: 100%;
left: 0;
top: 0;
background: rgba(0,0,0,0.2);
visibility: hidden;
opacity: 0;
-webkit-transition: 0.1s linear all !important;
-moz-transition: 0.1s linear all !important;
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/*
Ref:
http://www.jqueryscript.net/demo/Buttons-with-Built-in-Loading-Indicators-For-Bootsrap-3-Ladda-Bootstrap/
*/
$(window).load(function(){
// Bind normal buttons
Ladda.bind( 'div:not(.progress-demo) button', { timeout: 1500 } );
// Bind progress buttons and simulate loading progress
Ladda.bind( '.progress-demo button', {
callback: function( instance ) {
var progress = 0;
var interval = setInterval( function() {
progress = Math.min( progress + Math.random() * 0.1, 1 );
instance.setProgress( progress );
if( progress === 1 ) {
instance.stop();
clearInterval( interval );
}
}, 200 );
}
} );
// You can control loading explicitly using the JavaScript API
// as outlined below:
// var l = Ladda.create( document.querySelector( 'button' ) );
// l.start();
// l.stop();
// l.toggle();
// l.isLoading();
// l.setProgress( 0-1 );
});
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Related: See More


Questions / Comments: