JSFiddle - React, Tailwind, and code Playground
HTML
<button id="myButton">Click Me</button>
JavaScript
document.triggerNotification = function(type, message) {
var notification = $("<div class='push-notification push-" + type + "'>" + message + "</div>");
jQuery(document.body).append(notification);
setTimeout(function() {
notification.fadeOut(1200, function() {
notification.remove();
})
}, 1500);
};
$(function() {
$('#myButton').click(function() {
document.triggerNotification('test', 'A notification!');
});
});