Theme: Normal

# PNotify

Beautiful JavaScript notifications.

Download PNotify 3 PNotify on GitHub
Using PNotify Bug Report/Feature Request

#### Download a PNotify Bundle

### Optional Styling

Bright Theme
Stand-alone theme. You can uncheck this if you're using Bootstrap or jQuery UI.

### Modules

Desktop
Notifications that display even when the web page is not visible.
Buttons
Sticker and a closer buttons.
NonBlock
Click through to things underneath the notice.
Mobile
Notices on mobile phones and tablets.
Animate
Fluid CSS animations using Animate.css. (Requires Animate.css.)
Confirm
Confirmation dialogs and prompts.
Callbacks
Manipulate the notice during its lifecycle.
History
Redisplay old notices.

### Minification

Minify the Script and Stylesheet
It is a good idea to enable this on production services, so you get faster transfer times.

#### Using PNotify

PNotify downloads come with the following files:
`pnotify.custom.js` or `pnotify.custom.min.js` (Minified)
`pnotify.custom.css` or `pnotify.custom.min.css` (Minified)

So here's how you'd include them on your page:

    <script type="text/javascript" src="pnotify.custom.min.js"></script>
    <link href="pnotify.custom.min.css" media="all" rel="stylesheet" type="text/css" />

You also need to include jQuery (1.6 or higher) and either Bootstrap CSS or a jQuery UI Theme. If you want to use jQuery UI effect animations, you also need to include the jQuery UI JavaScript.

Now you can use PNotify like this:

    <script type="text/javascript">
    $(function(){
        new PNotify({
            title: 'Regular Notice',
            text: 'Check me out! I\'m a notice.'
        });
    });
    </script>

If you are not using any UI library, you can use the included styling, called Bright Theme. It is the default.

If you are using Bootstrap version 3, include this line somewhere before your first notice:

    PNotify.prototype.options.styling = "bootstrap3";

If you are using jQuery UI, include this line somewhere before your first notice:

    PNotify.prototype.options.styling = "jqueryui";

If you are using Bootstrap 3 with Font Awesome, include this line somewhere before your first notice:

    PNotify.prototype.options.styling = "fontawesome";

All of the demos on this page provide source code with the "See the source" dropdown,

### About

PNotify is a JavaScript notification system, developed by SciActive.
PNotify provides desktop notifications based on the Web Notifications spec. If desktop notifications are not available or not allowed, PNotify will fall back to displaying the notice as a regular, in-browser notice.

### Mobile Ready

PNotify works on your phone and tablet. You can swipe notices away to dismiss them.

### Unobtrusive

PNotify can provide non-blocking notices that allow the user to click elements behind the notice without even having to dismiss it.

See All Features

### Themeable

PNotify can use Bootstrap or jQuery UI themes. Try out some of the readymade themes using the selector in the top right corner of this page.

### Completely Open

PNotify is distributed under the Apache License, Version 2.0.

### Did you know?

This is the stable site. You can download code here that's tested and proven to work. However, if you like to live dangerously, you can also check out the development site.

### Caution warning danger attention!

This is the development site. It's a playground for bleeding edge features and code that probably won't work. The newer features listed in the download dialog won't work.

#### PNotify Features

- Rich graphical features and effects.
  - Bootstrap, Font Awesome, jQuery UI, and any other CSS based icons.
  - Mobile styling and swipe away support.
  - Timed hiding with visual effects.
  - Standard and custom effects.
  - Add custom classes for individual notice styling.
  - Variable opacity.
  - Optional drop shadows.
- Highly customizable UI.
  - Sticky (no automatic hiding) notices.
  - Optional hide and sticker buttons.
  - Non-blocking notices for less intrusive use.
  - Three notification types: notice, info, and error.
  - Stacks allow notice sets to stack independently.
    - Control stack direction and push to top or bottom.
- Feature rich API.
  - Desktop notifications based on the draft Web Notifications standard.
  - Supports dynamically updating text, title, icon, type...
  - Supports HTML (including forms) in title and text.
    - Can also escape HTML to prevent XSS attack.
  - Callbacks for various events, which can cancel said events.
  - History viewer allows user to review previous notices.

# Simple Demos These demos only use core PNotify features.

### Choose the Styling

PNotify supports three styling methods and three popular icon sets.
Bright Theme Bootstrap Font Awesome Icons jQuery UI

### PNotify Core

### Login to Continue

Just an example.

Username
Password
Remember Me Lasts for 2 weeks.
As you can see, I don't allow HTML in my content.
This prevents things like cross site scripting attacks:

How to style like Growl.

#### Styling Notices Like Growl

To custom style a notice, you need to use a class. For this example, we'll use "custom".

Here's some CSS to make custom notices look like Apple Growl:

    .ui-pnotify.custom .ui-pnotify-container {
    background-color: #404040 !important;
    background-image: none !important;
    border: none !important;
    -moz-border-radius: 10px;
    -webkit-border-radius: 10px;
    border-radius: 10px;
    }
    .ui-pnotify.custom .ui-pnotify-title, .ui-pnotify.custom .ui-pnotify-text {
    font-family: Arial, Helvetica, sans-serif !important;
    text-shadow: 2px 2px 3px black !important;
    font-size: 10pt !important;
    color: #FFF !important;
    padding-left: 50px !important;
    line-height: 1 !important;
    text-rendering: geometricPrecision !important;
    }
    .ui-pnotify.custom .ui-pnotify-title {
    font-weight: bold;
    }
    .ui-pnotify.custom .ui-pnotify-icon {
    float: left;
    }
    .ui-pnotify.custom .fa {
    margin: 3px;
    width: 33px;
    height: 33px;
    font-size: 33px;
    color: #FF0;
    }

And here's the JavaScript to use this styling:

    new PNotify({
        title: 'Custom Styling',
        text: 'I have an additional class that\'s used to give me special styling. I always wanted to be pretty.',
        addclass: 'custom',
        icon: 'fa fa-file-image-o',
        opacity: .8,
        nonblock: {
            nonblock: true
        }
    });

# Module Demos

Implements the Web Notifications spec.

### Desktop Module Notifications that display even when the web page is not visible.

The first time you click one of these buttons, you will be asked to grant permission for this site to show notices. Then you can click them again to see the desktop notification.

If your browser doesn't support Web Notifications, or you deny permission to show them, you will only see regular in-browser notices. You can check here.

### Buttons Module Sticker and a closer buttons.

Since the Buttons module provides buttons by default, many of the demos on this page include the buttons.

### NonBlock Module Click through to things underneath the notice.

### Mobile Module Notices on mobile phones and tablets.

Since the Mobile module provides support by default, most of the demos on this page work on mobile.

### Animate Module Fluid CSS animations using Animate.css.

Some good looking presets:
Or build your own:
Effect in
Effect out
Attention seekers:

### Confirm Module Confirmation dialogs and prompts.

### Callbacks Module Manipulate the notice during its lifecycle.

### History Module Redisplay old notices.

### Reference Module A reference for when you are coding your own module.

# Stacks PNotify core comes with several default stacks.

### Examples of Custom Stacks

Top Left. Moves down, then right. Pushes to stack top.

Bottom Left. Moves right, then up. Pushes to stack top.

Bottom Right. Moves up, then left. Pushes to stack bottom.

Custom. Moves right, then down. Pushes to stack bottom.

Custom. Moves left, then up. Pushes to stack top.

### Really Different Stacks

Modal stack. Moves down, then right. Pushes to stack top.

Top bar style. (Like Old Microsoft Notification Bars.) Moves down, then right. Pushes to stack top.

Bottom bar style. (Like New Microsoft Notification Bars.) Moves up, then right. Pushes to stack bottom.

Tooltip

### Stack Contexts

By default, a stack will place its notices underneath the body node. You can also specify a context for your notices to be placed in.

Modal:

### Stack Context

I'm the stack context where notices will be placed. I'm position: relative, so the notices will be positioned relative to me. My overflow is set to auto, so the notices won't show beyond my borders.

# Customization and Tools

### Timer

Current Timer:

### Consuming the Alert Function

This isn't really a feature of PNotify, but it's cool.

3. Repeat step 1.

# Comments

comments powered by Disqus

© 2011-2015 Hunter Perrin. All Rights Reserved.