11modal.html 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  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. <style type="text/css">
  14. :focus {
  15. border-style: dotted !important;
  16. border-width: 2px !important;
  17. border-color: chartreuse !important;
  18. }
  19. </style>
  20. </head>
  21. <body>
  22. <div class="modal fade" id="myModal">
  23. <!-- Sizing wrapper -->
  24. <!-- default width: 600px, modal-lg: 900px, modal-sm: 300px -->
  25. <div class="modal-dialog modal-sm">
  26. <!-- Content wrapper -->
  27. <div class="modal-content">
  28. <!-- Modal header -->
  29. <div class="modal-header">
  30. <button type="button" class="close" data-dismiss="modal">&times;</button>
  31. <h4 class="modal-title">1 Welcome back!</h4>
  32. </div>
  33. <!-- Modal body -->
  34. <div class="modal-body">
  35. <h1>1 Hello readers!</h1>
  36. </div>
  37. <!-- Modal footer -->
  38. <div class="modal-footer">
  39. <button type="button" class="btn btn-default" data-dismiss="modal">1 Close</button>
  40. <button type="button" class="btn btn-primary" data-dismiss="modal">1 Save</button>
  41. </div>
  42. </div>
  43. </div>
  44. </div>
  45. <div class="container">
  46. <button type="button" class="btn btn-primary btn-lg" data-toggle="modal" data-target="#myModal">
  47. Trigger modal
  48. </button>
  49. <a href="11modal-content.html" class="btn btn-danger btn-lg" data-toggle="modal" data-target="#myModal">Remote A</a>
  50. <button type="button" class="btn btn-default btn-lg" onclick="openModal()">Remote JS</button>
  51. <h3>Try thi</h3>
  52. <ol>
  53. <li>Click first button</li>
  54. <li>Close modal</li>
  55. <li>Click second or third button</li>
  56. <li>Note the version loaded (1 or 2 ?)</li>
  57. <li>Reload page</li>
  58. <li>Click second or third button</li>
  59. <li>Close modal</li>
  60. <li>Click first button</li>
  61. <li>Note the version loaded (1 or 2 ?)</li>
  62. <li>Ponder</li>
  63. </ol>
  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. function openModal() {
  70. var options = {
  71. // false: no backdrop, "static": do not close when clicking outside modal
  72. backdrop: "static",
  73. // enable ESC key to close modal
  74. keyboard: false,
  75. // show modal
  76. show: true,
  77. // href in the <a> handle of the modal is loaded in modal-body
  78. // FIXME this demo fails at making it work.
  79. remote: false
  80. };
  81. $('#myModal').modal(options);
  82. }
  83. $('#myModal').on('show.bs.modal', function () {
  84. console.log('Showing modal');
  85. });
  86. $('#myModal').on('shown.bs.modal', function () {
  87. console.log('Modal shown');
  88. });
  89. $('#myModal').on('hide.bs.modal', function () {
  90. console.log('Hiding modal');
  91. });
  92. $('#myModal').on('hidden.bs.modal', function () {
  93. console.log('Modal hidden');
  94. });
  95. $('#myModal').on('loaded.bs.modal', function () {
  96. console.log('Modal loaded');
  97. });
  98. </script>
  99. </body>
  100. </html>