A jQuery plugin wrapper around Bootstrap 4 Alerts, to create fixed Alerts (also called Notifications) dynamically in JavaScript.
<script src="./node_modules/bootstrap-show-notification/src/bootstrap-show-notification.js"></script>
<script>
$("#button-show-simple").click(function () {
$.showNotification({body: "Hello Notification!"})
})
$("#button-show-info").click(function () {
const notification = $.showNotification({
body: "<h3>For your Info</h3><p>This notification has a headline and more text than the previous one.</p><div><button class='btn btn-info'>Click me</button></div>",
type: "info"
})
notification.element.querySelector(".btn-info").addEventListener("click", () => {
$.showNotification({
body: "Thank you for clicking", type: "success", direction: "append"
})
})
})
$("#button-show-danger").click(function () {
$.showNotification({
body: "Danger!", type: "danger"
})
})
$("#button-show-sticky").click(function () {
$.showNotification({
body: "This notification will stay", type: "secondary", duration: 0
})
})
</script>