maxulyanov / JNotice

Javascript notification in the browser

Home Page:http://m-ulyanov.github.io/JNotice/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

JNotice

Great Javascript notification in the browser

Getting started

  1. npm install jnotice your project or download archive
  2. Include JNotice.js, JNotice.css and JNotice-animate.css
  3. Create instance JNotice with your options
  4. Add the object to the notification
  5. Call JNotice at the right time
<script>
   var jnotice = new JNotice();
   jnotice.add({html: 'Hello world JNotice!', duration: 3000});
   jnotice.call();
</script>

Instance options

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

Notification object options

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

Public methods

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

Events

show - Moment show the notification
hide - Moment hide the notification. event.hideIsUser - will help to identify hide user or system timer

Browsers support

Chrome, FF, Opera, Safari, IE9+

Example

See example - JNotice

About

Javascript notification in the browser

http://m-ulyanov.github.io/JNotice/

License:MIT License


Languages

Language:JavaScript 44.4%Language:Less 27.9%Language:CSS 27.7%