bootstrap-show-notification
This component is Bootstrap 4 only. For a Bootstrap 5 compatible
package with similar functionality, see bootstrap-show-toast.
A jQuery plugin wrapper around Bootstrap 4 Alerts, to show them as toasts (also called notifications) dynamically from JavaScript.
![bootstrap-show-notification Example](https://shaack.com/projekte/assets/img/bootstrap-show-notification-lg.png?v=2)
=>
- Responsive and mobile friendly
- Needs no extra CSS
Try it
Installation
npm install bootstrap-show-notification
Usage
<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 () {
$.showNotification({
body: "<h3>For your Info</h3>This notification has a title and a body and more text than the previous one.", type: "info"
})
})
$("#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>
Props (defaults)
this.props = {
body: "",
type: "primary",
duration: 5500,
maxWidth: "520px",
shadow: "0 2px 6px rgba(0,0,0,0.2)",
zIndex: 100,
margin: "1rem",
direction: "prepend"
}
Documentation
More Bootstrap extensions
Check out my further Bootstrap extensions