Details | Last modification | View Log | RSS feed
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 1 | espaco | 1 | var UIButtons = function () { |
| 2 | |||
| 3 | var handleButtons = function () { |
||
| 4 | $('.demo-loading-btn').click(function () { |
||
| 5 | var btn = $(this) |
||
| 6 | btn.button('loading') |
||
| 7 | setTimeout(function () { |
||
| 8 | btn.button('reset') |
||
| 9 | }, 3000) |
||
| 10 | }); |
||
| 11 | |||
| 12 | Ladda.bind( '.mt-ladda-btn', { timeout: 2000 } ); |
||
| 13 | Ladda.bind( '.mt-ladda-btn.mt-progress-demo ', { |
||
| 14 | callback: function( instance ) { |
||
| 15 | var progress = 0; |
||
| 16 | var interval = setInterval( function() { |
||
| 17 | progress = Math.min( progress + Math.random() * 0.1, 1 ); |
||
| 18 | instance.setProgress( progress ); |
||
| 19 | |||
| 20 | if( progress === 1 ) { |
||
| 21 | instance.stop(); |
||
| 22 | clearInterval( interval ); |
||
| 23 | } |
||
| 24 | }, 200 ); |
||
| 25 | } |
||
| 26 | } ); |
||
| 27 | } |
||
| 28 | |||
| 29 | return { |
||
| 30 | //main function to initiate the module |
||
| 31 | init: function () { |
||
| 32 | handleButtons(); |
||
| 33 | } |
||
| 34 | |||
| 35 | }; |
||
| 36 | |||
| 37 | }(); |
||
| 38 | |||
| 39 | jQuery(document).ready(function() { |
||
| 40 | UIButtons.init(); |
||
| 41 | }); |