Ladda for Bootstrap 3 Button Loading Progress Plugin

Add-ons
2026-07-25 23:36 3 次浏览 • 0 次下载 7.2KB
Ladda for Bootstrap 3 Button Loading Progress Plugin

Usage

Add the bootstrap.css stylesheet, spin.min.js, and ladda.min.js to your page.

1
2
3
<script src="dist/spin.min.js"></script>
<script src="dist/ladda.min.js"></script>


Then add a button with the following styles:

1
<button class="btn btn-primary ladda-button" data-style="expand-left"><span class="ladda-label">expand-left</span></button>


Or use an "a" tag:

1
<a href="#" class="btn btn-primary ladda-button" data-style="expand-left"><span class="ladda-label">expand-left</span></a>


You can select a style by setting the data-style attribute:

1
2
3
4
5
6
7
8
9
10
11
data-style="expand-left"
data-style="expand-left"
data-style="expand-right"
data-style="expand-up"
data-style="zoom-in"
data-style="zoom-out"
data-style="slide-left"
data-style="slide-right"
data-style="slide-up"
data-style="slide-down"
data-style="contract"


You can control the size by setting the data-size attribute:

1
2
3
data-size="xs"
data-size="s"
data-size="l"


You can choose the spinner color by setting the data-spinner-color attribute (hex code):

1
data-spinner-color="#FF0000"


Control the UI state with JavaScript:

1
Ladda.bind( 'input[type=submit]' );


When using AJAX forms, you can use the following syntax:

1
<a href="#" id="form-submit" class="btn btn-primary btn-lg ladda-button" data-style="expand-right" data-size="l"><span class="ladda-label">Submit form</span></a>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
$(function() {
$('#form-submit').click(function(e){
e.preventDefault();
var l = Ladda.create(this);
l.start();
$.post("your-url",
{ data : data },
function(response){
console.log(response);
}, "json")
.always(function() { l.stop(); });
return false;
});
});

Other methods can be called through JavaScript

星河码客

发现和分享优质开源项目,传承互联网精神,为开发者服务。

关于本站

联系我们

微信/广告合作:ITcloub (备注星河码客)

免责声明:本站资源版权归原作者所有,仅供学习与交流。如有侵权,请通过「关于我们 - 侵权投诉」联系删除。

Powered by Nuxt · Deployed on Cloudflare