Great Javascript notification in the browser
npm install jnotice
your project or download archive- Include JNotice.js, JNotice.css and JNotice-animate.css
- Create instance JNotice with your options
- Add the object to the notification
- Call JNotice at the right time
<script>
var jnotice = new JNotice();
jnotice.add({html: 'Hello world JNotice!', duration: 3000});
jnotice.call();
</script>
Name | Description | Default value |
---|---|---|
methodShow | Show the following message after you hide the current or all at once | 'default' |
animationShow | What animation to use to show | 'bounceIn' |
animationHide | What animation to use to hide | 'bounceOutLeft' |
position | Determines the position in which a notification will be show | {x: 'left', y: 'top'} |
duration | Duration show notification in ms | 2000 |
saveLocalStorage | Synchronization instance storage with localStorage | false |
removeToClick | To delete a notice by clicking on notice | true |
removeToClickAll | To delete all notice by clicking on notice | false |
Name | Description |
---|---|
html | Html notification |
type | Type notification, there are five options: `default`, `info`, `success`, `warning`, `error` |
duration | Duration show current notification in ms |
callbacks | Object with two methods: show and hide |
add
- Add notification in storage. It may be an object or an array of objects.
call
- Call added notification
getStorage
- Get the current storage
clearStorage
- Clear the current storage
dismissAll
- Hide all shown now notification
destroy
- remove container and all notification
show
- Moment show the notification
hide
- Moment hide the notification. event.hideIsUser - will help to identify hide user or system timer
Chrome, FF, Opera, Safari, IE9+
See example - JNotice