Introduction
I'm using the Bootstrap-Notify script to display great visual alerts to my users. But to use the full strength of the script I want to hook into the events of the script. Unfortunately, there is no example either in the documentation or on other open-source platforms like GitHub.
My approach
As described in the Documentation I've linked above, I used the onClose
attribute together with a function:
$(document).ready(function() {
//Notifications
var welcome = $.notify({
message: "Test"
}, {
onClose: test()
});
});
function test() {
console.log("onClose");
}
I've made a short fiddle to show you that it doesn't work as thought (in my case the test
function which should be called on close of the notification triggers already on script start). Other approaches like welcome.onClose(test());
also failed.
So, how to hook into the events of Bootstrap-Notify succesfully?