npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

jquery-notifier

v1.0.3

Published

jQuery Notify is a jQuery plugin that easily displays html notifications.

Downloads

65

Readme

jQuery Notify

jQuery Notify is a jQuery plugin that easily displays html notifications.

Please visit www.vicreative.nl for full documentation.

Install

npm install jquery-notifier

Usage

import "jquery-notifier";

scss

import "jquery-notifier/src/notify.scss";

css

import "jquery-notifier/lib/notify.css";

The notify plugin makes displaying notifications easy.
Every notification will be visible for a configurable time, but can also be made sticky.
Every notification container element has its own queue of notification messages. The position of the notification messages are automatically updated when a notification message is added or removed.
The notification can also contain HTML.
By default, the notify plugin contains 4 types:

  • info, the default notification, visible for 3 seconds.
  • success, a sticky notifcation for success messages.
  • error, a sticky notification for error messages.
  • warning, a sticky notification for warnings.

The configuration of these types can be customized and custom types can be added. The rendering of these types is customizable.
By default. there are 2 styles:

  • bar, a full width bar
  • box, a box positioned on the right of the window

Custom styles can be added.

Helpers

$.notify.create

The $.notify.create function creates and returns a text based notification. This function has two arguments, the text for the notification and the notifcation options. The last argument is optional.

var notification = $.notify.create("some notification text", { /* configuration options */ });

Type Configuration

All types can be configured and all have a default configuration set.
The default configuration set can also be changed. The $.notify.settings object holds the configuration for all types.
The name of the type is the key of the object. When no type is set, the settings for the type info ($.notify.settings.info or $.notify.settings["info"]) are used. Custom types can be added as well. Simply add a new key to $.notify.settings and create a notification with the type set to this key.
All options defined below can be set in the settings object. The settings object of the provided type will extend the settings object of type info.

$.notify.settings["info"].sticky = true;

In this example, the sticky property of notifications of type info is set to true. All notifications of type info will now be sticky.

Options

adjustContent

Sets whether the content in the container should be adjusted to make room for the notification.
Note: When adjustScroll is set to true, this property is ignored.

datatype: Boolean

default: false

$(".notification").notify({ adjustContent : false });

adjustScroll

Sets whether the notification should adjust to scrolling and bind to the scroll event.
Note: When set to true, the adjustContent property is ignored.

datatype: Boolean

default: false

$(".notification").notify({ adjustScroll: true });

animationDuration

Sets the duration of the hide and show animation in miliseconds.

datatype: Integer

default: 500

$(".notification").notify({ animationDuration : 500 });

appendTo

Sets the selector for the container element of the notifications. All notifications will be appended to this container element and added to its queue of notification messages.

datatype: String

default: "body"

$(".notification").notify({ appendTo : ".menu > .notifications" });

autoShow

Sets whether the notification should be immediately shown after initialization.

datatype: Boolean

default: true

$(".notification").notify({ autoShow : true });

closeText

Sets the text of the close icon.

datatype: String

default: "X"

$(".notification").notify({ closeText : "X" });

displayTime

Sets the visibility time of the notification in miliseconds.

datatype: Integer

default: 3000

$(".notification").notify({ displayTime : 3000 });

notifyClass

Adds a custom class to the notification element.

datatype: String

default: ""

$(".notification").notify({ notifyClass: "myCustomClass" });

opacity

Sets the opacity of the notification message.

datatype: Double

default: 1

$(".notification").notify({ opacity: 0.8 });

sticky

Sets whether the notification is sticky and can only be removed by clicking on the close icon.

datatype: Boolean

default: false, for type success and error the default value is true

$(".notification").notify({ sticky : false });

style

Sets the rendering style of the notification message.

datatype: String

default: 'bar'

possible values: 'bar', 'box'. Custom styles can be added.

$(".notification").notify({ style: 'box' });

type

Sets the type of the notification message. This will change the rendering and sets the default options to the options of the corresponding type.

datatype: String

default: 'info'

possible values: 'info', 'success', 'error', 'warning'. Custom types can be added.

$(".notification").notify({ type: 'success' });

Events

beforeShow

The beforeShow event is raised before the show animation of the notification has started.

arguments:

  • beforeShow event
  • notify object: "element" property containing element to notify and "settings" property containing the settings for this notify object.
$(".notification").notify({ 
    beforeShow : function(event, notify) {
        var notifier = $(this); // reference to notification element 
    }
});

afterShow

The afterShow event is raised after the show animation of the notification has completed.

arguments:

  • afterShow event
  • notify object: "element" property containing element to notify and "settings" property containing the settings for this notify object.
$(".notification").notify({ 
    afterShow : function(event, notify) {
        var notifier = $(this); // reference to notification element 
    }
});

beforeHide

The beforeHide event is raised before the hide animation of the notification has started.

arguments:

  • beforeHide event
  • notify object: "element" property containing element to notify and "settings" property containing the settings for this notify object.
$(".notification").notify({ 
    beforeHide : function(event, notify) {
        var notifier = $(this); // reference to notification element 
    }
});

afterHide

The afterHide event is raised after the hide animation of the notification has completed.

arguments:

  • afterHide event
  • notify object: "element" property containing element to notify and "settings" property containing the settings for this notify object.
$(".notification").notify({ 
    afterHide : function(event, notify) {
        var notifier = $(this); // reference to notification element 
    }
});

Methods

show

Shows the notification.

$(".notification").notify("show");

hide

Hides the notification.

$(".notification").notify("hide");

destroy

Destroys the notification element and unbinds all events.

$(".notification").notify("destroy");

Requirements

  • jQuery 1.8.3+ (could also work on previous versions, but is not tested)