index.html 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  1. <!doctype html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>Ladda</title>
  6. <meta name="description" content="">
  7. <meta name="author" content="Hakim El Hattab">
  8. <meta name="apple-mobile-web-app-capable" content="yes" />
  9. <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
  10. <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
  11. <link rel="stylesheet" href="css/demo.css">
  12. <link rel="stylesheet" href="dist/ladda.min.css">
  13. <!--[if lt IE 9]>
  14. <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
  15. <![endif]-->
  16. </head>
  17. <body>
  18. <article class="examples">
  19. <div class="intro">
  20. <h1>Ladda</h1>
  21. <p>
  22. A UI concept which merges loading indicators into the action that invoked them. Primarily intended for use with forms where
  23. it gives users immediate feedback upon submit rather than leaving them wondering while the browser does its thing. For a
  24. real-world example, check out any of the forms on <a href="http://slid.es">slid.es</a>.
  25. </p>
  26. </div>
  27. <section class="button-demo">
  28. <h3>expand-left</h3>
  29. <button class="ladda-button" data-color="green" data-style="expand-left">Submit</button>
  30. </section>
  31. <section class="button-demo">
  32. <h3>expand-right</h3>
  33. <button class="ladda-button" data-color="green" data-style="expand-right">Submit</button>
  34. </section>
  35. <section class="button-demo">
  36. <h3>expand-up</h3>
  37. <button class="ladda-button" data-color="green" data-style="expand-up">Submit</button>
  38. </section>
  39. <section class="button-demo">
  40. <h3>expand-down</h3>
  41. <button class="ladda-button" data-color="green" data-style="expand-down">Submit</button>
  42. </section>
  43. <section class="button-demo">
  44. <h3>contract</h3>
  45. <button class="ladda-button" data-color="red" data-style="contract">Submit</button>
  46. </section>
  47. <section class="button-demo">
  48. <h3>contract-overlay</h3>
  49. <button class="ladda-button" data-color="red" data-style="contract-overlay" style="z-index: 10;">Submit</button>
  50. </section>
  51. <section class="button-demo">
  52. <h3>zoom-in</h3>
  53. <button class="ladda-button" data-color="red" data-style="zoom-in">Submit</button>
  54. </section>
  55. <section class="button-demo">
  56. <h3>zoom-out</h3>
  57. <button class="ladda-button" data-color="red" data-style="zoom-out">Submit</button>
  58. </section>
  59. <section class="button-demo">
  60. <h3>slide-left</h3>
  61. <button class="ladda-button" data-color="blue" data-style="slide-left">Submit</button>
  62. </section>
  63. <section class="button-demo">
  64. <h3>slide-right</h3>
  65. <button class="ladda-button" data-color="blue" data-style="slide-right">Submit</button>
  66. </section>
  67. <section class="button-demo">
  68. <h3>slide-up</h3>
  69. <button class="ladda-button" data-color="blue" data-style="slide-up">Submit</button>
  70. </section>
  71. <section class="button-demo">
  72. <h3>slide-down</h3>
  73. <button class="ladda-button" data-color="blue" data-style="slide-down">Submit</button>
  74. </section>
  75. <h3 id="progress">Built-in progress bar</h3>
  76. <section class="progress-demo">
  77. <h3>expand-right</h3>
  78. <button class="ladda-button" data-color="purple" data-style="expand-right">Submit</button>
  79. </section>
  80. <section class="progress-demo">
  81. <h3>contract</h3>
  82. <button class="ladda-button" data-color="purple" data-style="contract">Submit</button>
  83. </section>
  84. <h3 id="sizes">Sizes</h3>
  85. <section class="progress-demo">
  86. <h3>Extra Small</h3>
  87. <button class="ladda-button" data-color="mint" data-style="expand-right" data-size="xs">Submit</button>
  88. </section>
  89. <section class="progress-demo">
  90. <h3>Small</h3>
  91. <button class="ladda-button" data-color="mint" data-style="expand-right" data-size="s">Submit</button>
  92. </section>
  93. <section class="progress-demo">
  94. <h3>Large</h3>
  95. <button class="ladda-button" data-color="mint" data-style="expand-right" data-size="l">Submit</button>
  96. </section>
  97. <section class="progress-demo">
  98. <h3>Extra Large</h3>
  99. <button class="ladda-button" data-color="mint" data-style="expand-right" data-size="xl">Submit</button>
  100. </section>
  101. <footer>
  102. <small class="sharing">
  103. <a href="http://twitter.com/share" class="twitter-share-button" data-text="Ladda - Buttons with built-in loading indicators by @hakimel" data-url="http://lab.hakim.se/ladda" data-count="small" data-related="hakimel"></a>
  104. </small>
  105. <small class="outro">by <a href="http://hakim.se">Hakim El Hattab</a> / <a href="http://twitter.com/hakimel">@hakimel</a></small>
  106. </footer>
  107. </article>
  108. <script src="dist/spin.min.js"></script>
  109. <script src="dist/ladda.min.js"></script>
  110. <script>
  111. // Bind normal buttons
  112. Ladda.bind( '.button-demo button', { timeout: 2000 } );
  113. // Bind progress buttons and simulate loading progress
  114. Ladda.bind( '.progress-demo button', {
  115. callback: function( instance ) {
  116. var progress = 0;
  117. var interval = setInterval( function() {
  118. progress = Math.min( progress + Math.random() * 0.1, 1 );
  119. instance.setProgress( progress );
  120. if( progress === 1 ) {
  121. instance.stop();
  122. clearInterval( interval );
  123. }
  124. }, 200 );
  125. }
  126. } );
  127. // You can control loading explicitly using the JavaScript API
  128. // as outlined below:
  129. // var l = Ladda.create( document.querySelector( 'button' ) );
  130. // l.start();
  131. // l.stop();
  132. // l.toggle();
  133. // l.isLoading();
  134. // l.setProgress( 0-1 );
  135. </script>
  136. <a class="fork" href="https://github.com/hakimel/Ladda"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://github-camo.global.ssl.fastly.net/365986a132ccd6a44c23a9169022c0b5c890c387/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f7265645f6161303030302e706e67" alt="Fork me on GitHub"></a>
  137. <script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script>
  138. </body>
  139. </html>