Step by step guide
- Import nofityG.min.js into your project.
- If you want show notification, first you must ask user to allow it. It’s not easy, because notification request is fired only by click event (triggers not works). So bind
notifyG.permission()function as click event on some element on you page (for example, I’m using it on all links on page). Notification request is called only once per visit.
- Now you can call
notifyG.create('notify image', 'notify title', 'notify content', notify_callback)for create desktop notification whenever you want.
- Notification is hide after 5 seconds or when user click on notification. You can change global hide interval setting by call
notifyG.timeoutValue(time in ms).
- For hide all notifications, just call
It’s all, it’s simple! Just try it. If you want not-minified version of plugin, write me a comment, I’ll send you on your e-mail.
NotifyG on Bitbucket
Demo (only in Chrome)