Toasts are lightweight notifications designed to mimic the push notifications that have been popularized by mobile and desktop operating systems. They’re built with flexbox, so they’re easy to align and position.
Read more about toast in the official Bootstrap Docs.
"use strict";
document.addEventListener("DOMContentLoaded", function () {
var toastElList = [].slice.call(document.querySelectorAll(".toast"));
var toastList = toastElList.map(function (toastEl) {
return new bootstrap.Toast(toastEl);
});
var toastButtonList = [].slice.call(document.querySelectorAll(".toast-btn"));
toastButtonList.map(function (toastButtonEl) {
toastButtonEl.addEventListener("click", function () {
var toastToTrigger = document.getElementById(toastButtonEl.dataset.target);
if (toastToTrigger) {
var toast = bootstrap.Toast.getInstance(toastToTrigger);
toast.show();
}
});
});
});