Sometimes this function can be called too quickly and multiple elements are created but since it uses an ID that's not unique to each instance it the part to fade out and remove the div only applies to the top level element, not all of them. So I end up with a static div tag that isn't fading/removing.
The best thing I can think to do is to simply repeat the process again. How do I do that, or is there a better method?
document.triggerNotification = function (type, message) {
jQuery(document.body).append("<div class='push-notification push-"+type+"' id='notification'>"+message+"</div>");
jQuery('#notification').delay(1500).fadeOut(1200, function () {
jQuery('#notification').remove();
});
}