I am trying to use Noty plugin to create notification in my application.
Unfortunately the documentation are more complected that I can understand. so I am failing to generate a simple alert that appears on the upper right hand of the screen.
Here is what I have done.
First, I included the following two files
noty/js/noty/jquery-noty.js
noty/js/noty/layouts/topRight.js
I added default configuration like this
$(function(){
$.noty.defaults = {
layout: 'topRight',
theme: 'defaultTheme',
type: 'alert',
text: '',
dismissQueue: true, // If you want to use queue feature set this true
template: '',
animation: {
open: { height: 'toggle' },
close: { height: 'toggle' },
easing: 'swing',
speed: 500 // opening & closing animation speed
},
timeout: true, // delay for closing event. Set false for sticky notifications
force: false, // adds notification to the beginning of queue when set to true
modal: false,
maxVisible: 5, // you can set max visible notification for dismissQueue true option
closeWith: ['click'], // ['click', 'button', 'hover']
callback: {
onShow: function () { },
afterShow: function () { },
onClose: function () { },
afterClose: function () { }
},
buttons: false // an array of buttons
};
});
Then I Added a click event to trigger the notification like this
$(function(){
$('#test').click(function(){
noty({
text: 'Simple Test!'
});
});
});
When I click the test button I get nothing on the screen and no errors in the console.
What am I doing wrong here? How can I create a simple notification that appears on the upper right hand side?