Loading bootstrap_barrio.libraries.yml +2 −0 Original line number Diff line number Diff line Loading @@ -174,6 +174,8 @@ toast: version: VERSION js: js/toast.js: {} dependencies: - bootstrap_barrio/bootstrap_js verticaltabs: version: VERSION Loading js/toast.js +9 −8 Original line number Diff line number Diff line /** * @file * Toast utilities. * * Displays any toast messages present on the page. */ (function ($, Drupal) { (function (Drupal) { 'use strict'; Drupal.behaviors.bootstrap_barrio_toast = { attach: function (context, settings) { $('.toast').toast('show'); attach: function () { var elements = [].slice.call(document.querySelectorAll('.toast')) var toasts = elements.map(function(toastEl) { return new bootstrap.Toast(toastEl); }); toasts.forEach(toast => toast.show()); } }; })(jQuery, Drupal); })(Drupal); Loading
bootstrap_barrio.libraries.yml +2 −0 Original line number Diff line number Diff line Loading @@ -174,6 +174,8 @@ toast: version: VERSION js: js/toast.js: {} dependencies: - bootstrap_barrio/bootstrap_js verticaltabs: version: VERSION Loading
js/toast.js +9 −8 Original line number Diff line number Diff line /** * @file * Toast utilities. * * Displays any toast messages present on the page. */ (function ($, Drupal) { (function (Drupal) { 'use strict'; Drupal.behaviors.bootstrap_barrio_toast = { attach: function (context, settings) { $('.toast').toast('show'); attach: function () { var elements = [].slice.call(document.querySelectorAll('.toast')) var toasts = elements.map(function(toastEl) { return new bootstrap.Toast(toastEl); }); toasts.forEach(toast => toast.show()); } }; })(jQuery, Drupal); })(Drupal);