Skip to content

wbotelhos/notify

Repository files navigation

jQuery Notify - A Notifier Plugin

Build Status NPM Version Dependency Dev Dependency Code Climate Patreon

Usage

<link rel="stylesheet" href="jquery.notify.css">
<script src="jquery.notify.js"></script>
$.notify('Hello World!');

Usage with Icon

  • jquery.notify.[eot|svg|ttf|woff]
<link rel="stylesheet" href="jquery.notify.css">
<link rel="stylesheet" href="jquery.notify.fonts.css">
<script src="jquery.notify.js"></script>
$.notify({ body: 'Hello World!', icon: 'notify-info' });

Bower Install

bower install notify

See bower.io for more information.

Options

afterClose:    undefined     // Callback executed after notice closes.
afterOpen:     undefined     // Callback executed after notice opens.
beforeClose:   undefined     // Callback executed before notice closes.
beforeOpen:    undefined     // Callback executed before notice opens.
body:          undefined     // Body of notice.
click:         undefined     // Callback executed when notice is clicked.
closeClick:    true          // If notice will be closed on click.
destroy:       false         // Removes the wrapper when there is no more notice on it.
forever:       false         // If notice will stay on screen forever.
hideTime:      1000          // Time spent to hide the notice.
icon:          undefined     // Icon (font) name for the notice.
id:            'notify-item' // Identifier to be used as class on notice.
image:         undefined     // Image path to be used into notice.
max:           5             // Number maximum of noticies on screen.
minimizeTime:  300           // Time spent to minimize the notice.
mouseout:      undefined     // Callback executed on mouse over the notice.
mouseover:     undefined     // Callback executed on mouse out the notice.
position:      undefined     // The place where notices will appears.
showTime:      400           // Time spent to show the notice.
timeout:       5000          // Time spent to initiates the other timeouts.
title:         undefined     // The notice title.
wrapper:       '#notify'     // Where notices will be appended.

Functions

First, save the notice reference:

var notice = $.notify('Hello World!');

Then you can use the functions:

notice.remove();               // Removes the notice from screen.

notice.position('class-name'); // Changes the notices position via CSS class.

Global Functions

$.notify.clean('name') // Clean the queue with name equal you passed or all when no name is given.