04buttons.html 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <title>Blasting off with Bootstrap</title>
  5. <meta charset="utf-8" />
  6. <meta http-equiv="X-UA-COMPATIBLE" content="IE=Edge" />
  7. <meta name="viewport" content="width=device-width, initial-scale=1" />
  8. <link rel="stylesheet" href="../css/bootstrap.min.css"/>
  9. <!--[if lt IE 9]>
  10. <script src="../js/html5shiv.3-7-0.js"></script>
  11. <script src="../js/respond.1-4-2.min.js"></script>
  12. <![endif]-->
  13. </head>
  14. <body>
  15. <div class="container">
  16. <div class="panel">
  17. <button class="btn btn-lg btn-default" data-toggle="button">
  18. Toggle me!
  19. </button>
  20. <p>Need to focus elsewhere to see the button return to normal.</p>
  21. </div>
  22. <div class="panel">
  23. <div class="panel-heading"><h3>Checkboxes</h3></div>
  24. <div class="panel-body">
  25. <div class="btn-group" data-toggle="buttons">
  26. <label class="btn btn-default">
  27. <input type="checkbox" />Option 1
  28. </label>
  29. <label class="btn btn-default">
  30. <input type="checkbox" />Option 2
  31. </label>
  32. <label class="btn btn-default">
  33. <input type="checkbox" />Option 3
  34. </label>
  35. </div>
  36. </div>
  37. </div>
  38. <div class="panel">
  39. <div class="panel-heading"><h3>Radios</h3></div>
  40. <div class="panel-body">
  41. <div class="btn-group" data-toggle="buttons">
  42. <label class="btn btn-info">
  43. <input name="options" type="radio" />Option 1
  44. </label>
  45. <label class="btn btn-info">
  46. <input name="options" type="radio" />Option 2
  47. </label>
  48. <label class="btn btn-info">
  49. <input name="options" type="radio" />Option 3
  50. </label>
  51. </div>
  52. </div>
  53. </div>
  54. <div class="panel">
  55. <div class="panel-heading"><h3>Progress / complete</h3></div>
  56. <div class="panel-body">
  57. <button id="myLoadingButton" type="button" class="btn btn-primary"
  58. data-loading-text="Loading stuff..."
  59. data-complete-text="Fully loaded!">
  60. Load data
  61. </button>
  62. <p>Note that, when in the "loading" state, Bootstrap sets .disabled and @disabled on the button.</p>
  63. </div>
  64. </div>
  65. <!-- https://ajax.googleapis.com/ajax/libs/jquery/1.11.1.jquery.min.js -->
  66. <script src="../js/jquery-1.11.2.min.js"></script>
  67. <script src="../js/bootstrap.js"></script>
  68. <script type="text/javascript">
  69. $(document).ready(function () {
  70. $('#myLoadingButton').click(function () {
  71. console.log("Setting loading");
  72. var that = this;
  73. $(this).button('loading');
  74. setTimeout(function () {
  75. console.log("Setting complete");
  76. $(that).button('complete');
  77. setTimeout(function () {
  78. console.log("Setting reset");
  79. $(that).button('reset');
  80. }, 2000);
  81. }, 2000);
  82. });
  83. // $('#myLoadingButton').click(function () {
  84. // $(this).button('reset');
  85. // });
  86. });
  87. </script>
  88. </div>
  89. </body>
  90. </html>