tour.js 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. /*=========================================================================================
  2. File Name: tour.js
  3. Description: tour
  4. ----------------------------------------------------------------------------------------
  5. Item name: Vuexy - Vuejs, HTML & Laravel Admin Dashboard Template
  6. Author: Pixinvent
  7. Author URL: hhttp://www.themeforest.net/user/pixinvent
  8. ==========================================================================================*/
  9. $(document).ready(function () {
  10. displayTour();
  11. $(window).resize(displayTour)
  12. var tour = new Shepherd.Tour({
  13. classes: 'shadow-md bg-purple-dark',
  14. scrollTo: true
  15. })
  16. // tour steps
  17. tour.addStep('step-1', {
  18. text: 'Here is page title.',
  19. attachTo: '.breadcrumbs-top .content-header-title bottom',
  20. buttons: [
  21. {
  22. text: "Skip",
  23. action: tour.complete
  24. },
  25. {
  26. text: 'Next',
  27. action: tour.next
  28. },
  29. ]
  30. });
  31. tour.addStep('step-2', {
  32. text: 'Check your notifications from here.',
  33. attachTo: '.dropdown-notification .icon-bell bottom',
  34. buttons: [
  35. {
  36. text: "Skip",
  37. action: tour.complete
  38. },
  39. {
  40. text: "previous",
  41. action: tour.back
  42. },
  43. {
  44. text: 'Next',
  45. action: tour.next
  46. },
  47. ]
  48. });
  49. tour.addStep('step-3', {
  50. text: 'Click here for user options.',
  51. attachTo: '.dropdown-user-link img bottom',
  52. buttons: [
  53. {
  54. text: "Skip",
  55. action: tour.complete
  56. },
  57. {
  58. text: "previous",
  59. action: tour.back
  60. },
  61. {
  62. text: 'Next',
  63. action: tour.next
  64. },
  65. ]
  66. });
  67. tour.addStep('step-4', {
  68. text: 'Buy this awesomeness at affordable price!',
  69. attachTo: '.buy-now bottom',
  70. buttons: [
  71. {
  72. text: "previous",
  73. action: tour.back
  74. },
  75. {
  76. text: "Finish",
  77. action: tour.complete
  78. },
  79. ]
  80. });
  81. // function to remove tour on small screen
  82. function displayTour() {
  83. window.resizeEvt;
  84. if ($(window).width() > 576) {
  85. $('#tour').on("click", function () {
  86. clearTimeout(window.resizeEvt);
  87. tour.start();
  88. })
  89. }
  90. else {
  91. $('#tour').on("click", function () {
  92. clearTimeout(window.resizeEvt);
  93. tour.cancel()
  94. window.resizeEvt = setTimeout(function () {
  95. alert("Tour only works for large screens!");
  96. }, 250);;
  97. })
  98. }
  99. }
  100. });