smartwizard-events.html 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>Smart Wizard - a JavaScript jQuery Step Wizard plugin</title>
  5. <meta charset="UTF-8">
  6. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  7. <!-- Include Bootstrap CSS -->
  8. <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css" integrity="sha384-rwoIResjU2yc3z8GV/NPeZWAv56rSmLldC3R/AZzGRnGxQQKnKkoFVhFQhNUwEyJ" crossorigin="anonymous">
  9. <!-- Optional Bootstrap Theme -->
  10. <link rel="stylesheet" href="../dist/css/bootstrap.min.css">
  11. <!-- Include SmartWizard CSS -->
  12. <link href="../dist/css/smart_wizard.css" rel="stylesheet" type="text/css" />
  13. <!-- Optional SmartWizard theme -->
  14. <link href="../dist/css/smart_wizard_theme_circles.css" rel="stylesheet" type="text/css" />
  15. <link href="../dist/css/smart_wizard_theme_arrows.css" rel="stylesheet" type="text/css" />
  16. <link href="../dist/css/smart_wizard_theme_dots.css" rel="stylesheet" type="text/css" />
  17. </head>
  18. <body>
  19. <div class="container">
  20. <form class="form-inline">
  21. <label class="mr-sm-2">Choose Theme:</label>
  22. <select id="theme_selector" class="custom-select mb-2 mr-sm-2 mb-sm-0">
  23. <option value="default">default</option>
  24. <option value="arrows">arrows</option>
  25. <option value="circles">circles</option>
  26. <option value="dots">dots</option>
  27. </select>
  28. <label class="mr-sm-2">External Buttons:</label>
  29. <div class="btn-group" role="group">
  30. <button class="btn btn-secondary" id="prev-btn" type="button">Go Previous</button>
  31. <button class="btn btn-secondary" id="next-btn" type="button">Go Next</button>
  32. <button class="btn btn-danger" id="reset-btn" type="button">Reset Wizard</button>
  33. </div>
  34. </form>
  35. <div class="alert alert-info" role="alert" id="message-box"><strong>Event Log:</strong></div>
  36. <!-- SmartWizard html -->
  37. <div id="smartwizard">
  38. <ul>
  39. <li><a href="#step-1">Step 1<br /><small>This is tab's description</small></a></li>
  40. <li><a href="#step-2">Step 2<br /><small>This is tab's description</small></a></li>
  41. <li><a href="#step-3">Step 3<br /><small>This is tab's description</small></a></li>
  42. <li><a href="#step-4">Step 4<br /><small>This is tab's description</small></a></li>
  43. </ul>
  44. <div>
  45. <div id="step-1" class="">
  46. <h2>Step 1 Content</h2>
  47. Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
  48. </div>
  49. <div id="step-2" class="">
  50. <h2>Step 2 Content</h2>
  51. <div>Hello This is a div</div>
  52. </div>
  53. <div id="step-3" class="">
  54. Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
  55. Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
  56. Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
  57. Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
  58. Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
  59. Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
  60. </div>
  61. <div id="step-4" class="">
  62. <h2>Step 4 Content</h2>
  63. <div class="card">
  64. <div class="card-header">My Details</div>
  65. <div class="card-block p-0">
  66. <table class="table">
  67. <tbody>
  68. <tr> <th>Name:</th> <td>Tim Smith</td> </tr>
  69. <tr> <th>Email:</th> <td>example@example.com</td> </tr>
  70. </tbody>
  71. </table>
  72. </div>
  73. </div>
  74. </div>
  75. </div>
  76. </div>
  77. </div>
  78. <!-- Include jQuery -->
  79. <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
  80. <!-- Include SmartWizard JavaScript source -->
  81. <script type="text/javascript" src="../dist/js/jquery.smartWizard.min.js"></script>
  82. <script type="text/javascript">
  83. $(document).ready(function(){
  84. // Smart Wizard events
  85. $("#smartwizard").on("leaveStep", function(e, anchorObject, stepNumber, stepDirection) {
  86. $("#message-box").append("<br /> > <strong>leaveStep</strong> called on " + stepNumber + ". Direction: " + stepDirection);
  87. var res = confirm("Do you want to leave the step "+stepNumber+"?");
  88. if(!res){
  89. $("#message-box").append(" <strong>leaveStep</strong> Cancelled");
  90. }else{
  91. $("#message-box").append(" <strong>leaveStep</strong> Allowed");
  92. }
  93. return res;
  94. });
  95. // This event should initialize before initializing smartWizard
  96. // Otherwise this event wont load on first page load
  97. $("#smartwizard").on("showStep", function(e, anchorObject, stepNumber, stepDirection, stepPosition) {
  98. $("#message-box").append(" > <strong>showStep</strong> called on " + stepNumber + ". Direction: " + stepDirection+ ". Position: " + stepPosition);
  99. });
  100. $("#smartwizard").on("beginReset", function(e) {
  101. $("#message-box").append("<br /> > <strong>beginReset</strong> called");
  102. });
  103. $("#smartwizard").on("endReset", function(e) {
  104. $("#message-box").append(" > <strong>endReset</strong> called");
  105. });
  106. $("#smartwizard").on("themeChanged", function(e, theme) {
  107. $("#message-box").append("<br /> > <strong>themeChanged</strong> called. New theme: " + theme);
  108. });
  109. // Toolbar extra buttons
  110. var btnFinish = $('<button></button>').text('Finish')
  111. .addClass('btn btn-info')
  112. .on('click', function(){ alert('Finish Clicked'); });
  113. var btnCancel = $('<button></button>').text('Cancel')
  114. .addClass('btn btn-danger')
  115. .on('click', function(){ $('#smartwizard').smartWizard("reset"); });
  116. // Smart Wizard initialize
  117. $('#smartwizard').smartWizard({
  118. selected: 0,
  119. theme: 'dots',
  120. transitionEffect:'fade',
  121. toolbarSettings: {toolbarPosition: 'bottom',
  122. toolbarExtraButtons: [btnFinish, btnCancel]
  123. }
  124. });
  125. // External Button Events
  126. $("#reset-btn").on("click", function() {
  127. // Reset wizard
  128. $('#smartwizard').smartWizard("reset");
  129. return true;
  130. });
  131. $("#prev-btn").on("click", function() {
  132. // Navigate previous
  133. $('#smartwizard').smartWizard("prev");
  134. return true;
  135. });
  136. $("#next-btn").on("click", function() {
  137. // Navigate next
  138. $('#smartwizard').smartWizard("next");
  139. return true;
  140. });
  141. $("#theme_selector").on("change", function() {
  142. // Change theme
  143. $('#smartwizard').smartWizard("theme", $(this).val());
  144. return true;
  145. });
  146. });
  147. </script>
  148. </body>
  149. </html>