ui-buttons-spinners.js
1.12 KB
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
38
39
40
41
42
var UIButtons = function () {
var handleButtons = function () {
$('.demo-loading-btn').click(function () {
var btn = $(this)
btn.button('loading')
setTimeout(function () {
btn.button('reset')
}, 3000)
});
Ladda.bind( '.mt-ladda-btn', { timeout: 2000 } );
Ladda.bind( '.mt-ladda-btn.mt-progress-demo ', {
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 );
}
} );
}
return {
//main function to initiate the module
init: function () {
handleButtons();
}
};
}();
jQuery(document).ready(function() {
UIButtons.init();
});