toastr.js 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. /*=========================================================================================
  2. File Name: toastr.js
  3. Description: Toastr notifications
  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. // Success Type
  11. $('#type-success').on('click', function () {
  12. toastr.success('Have fun storming the castle!', 'Miracle Max Says');
  13. });
  14. // Info Type
  15. $('#type-info').on('click', function () {
  16. toastr.info('We do have the Kapua suite available.', 'Turtle Bay Resort');
  17. });
  18. // Warning Type
  19. $('#type-warning').on('click', function () {
  20. toastr.warning('My name is Inigo Montoya. You killed my father, prepare to die!');
  21. });
  22. // Error Type
  23. $('#type-error').on('click', function () {
  24. toastr.error('I do not think that word means what you think it means.', 'Inconceivable!');
  25. });
  26. // Position Top Left
  27. $('#position-top-left').on('click', function () {
  28. toastr.info('I do not think that word means what you think it means.', 'Top Left!', { positionClass: 'toast-top-left', containerId: 'toast-top-left' });
  29. });
  30. // Position Top Center
  31. $('#position-top-center').on('click', function () {
  32. toastr.info('I do not think that word means what you think it means.', 'Top Center!', { positionClass: 'toast-top-center', containerId: 'toast-top-center' });
  33. });
  34. // Position Top Right
  35. $('#position-top-right').on('click', function () {
  36. toastr.info('I do not think that word means what you think it means.', 'Top Right!', { positionClass: 'toast-top-right', containerId: 'toast-top-right' });
  37. });
  38. // Position Top Full Width
  39. $('#position-top-full').on('click', function () {
  40. toastr.info('I do not think that word means what you think it means.', 'Top Full Width!', { positionClass: 'toast-top-full-width', });
  41. });
  42. // Position Bottom Left
  43. $('#position-bottom-left').on('click', function () {
  44. toastr.info('I do not think that word means what you think it means.', 'Bottom Left!', { positionClass: 'toast-bottom-left', containerId: 'toast-bottom-left' });
  45. });
  46. // Position Bottom Center
  47. $('#position-bottom-center').on('click', function () {
  48. toastr.info('I do not think that word means what you think it means.', 'Bottom Center!', { positionClass: 'toast-bottom-center', containerId: 'toast-bottom-center' });
  49. });
  50. // Position Bottom Right
  51. $('#position-bottom-right').on('click', function () {
  52. toastr.info('I do not think that word means what you think it means.', 'Bottom Right!', { positionClass: 'toast-bottom-right', containerId: 'toast-bottom-right' });
  53. });
  54. // Position Bottom Full Width
  55. $('#position-bottom-full').on('click', function () {
  56. toastr.info('I do not think that word means what you think it means.', 'Bottom Full Width!', { positionClass: 'toast-bottom-full-width' });
  57. });
  58. // Text Notification
  59. $('#text-notification').on('click', function () {
  60. toastr.info('Have fun storming the castle!', 'Miracle Max Says');
  61. });
  62. // Close Button
  63. $('#close-button').on('click', function () {
  64. toastr.success('Have fun storming the castle!', 'With Close Button', { "closeButton": true });
  65. });
  66. // Progress Bar
  67. $('#progress-bar').on('click', function () {
  68. toastr.warning('Have fun storming the castle!', 'Progress Bar', { "progressBar": true });
  69. });
  70. // Clear Toast Button
  71. $('#clear-toast-btn').on('click', function () {
  72. toastr.error('Clear itself?<br /><br /><button type="button" class="btn btn-primary clear">Yes</button>', 'Clear Toast Button');
  73. });
  74. // Immediately remove current toasts without using animation
  75. $('#show-remove-toast').on('click', function () {
  76. toastr.info('Have fun storming the castle!', 'Miracle Max Says');
  77. });
  78. $('#remove-toast').on('click', function () {
  79. toastr.remove();
  80. });
  81. // Remove current toasts using animation
  82. $('#show-clear-toast').on('click', function () {
  83. toastr.info('Have fun storming the castle!', 'Miracle Max Says');
  84. });
  85. $('#clear-toast').on('click', function () {
  86. toastr.clear();
  87. });
  88. // Fast Duration
  89. $('#fast-duration').on('click', function () {
  90. toastr.success('Have fun storming the castle!', 'Fast Duration', { "showDuration": 500 });
  91. });
  92. // Slow Duration
  93. $('#slow-duration').on('click', function () {
  94. toastr.warning('Have fun storming the castle!', 'Slow Duration', { "hideDuration": 3000 });
  95. });
  96. // Timeout
  97. $('#timeout').on('click', function () {
  98. toastr.error('I do not think that word means what you think it means.', 'Timeout!', { "timeOut": 5000 });
  99. });
  100. // Sticky
  101. $('#sticky').on('click', function () {
  102. toastr.info('I do not think that word means what you think it means.', 'Sticky!', { "timeOut": 0 });
  103. });
  104. // Slide Down / Slide Up
  105. $('#slide-toast').on('click', function () {
  106. toastr.success('I do not think that word means what you think it means.', 'Slide Down / Slide Up!', { "showMethod": "slideDown", "hideMethod": "slideUp", timeOut: 2000 });
  107. });
  108. // Fade In / Fade Out
  109. $('#fade-toast').on('click', function () {
  110. toastr.success('I do not think that word means what you think it means.', 'Slide Down / Slide Up!', { "showMethod": "fadeIn", "hideMethod": "fadeOut", timeOut: 2000 });
  111. });
  112. });