JavaScript Library for Creating Confidential Popup Notifications | Polipop.js

Polipop is a dependency-free JavaScript library for creating secret popup notifications. Polipop.js is a regular JS library to display recent, customizable notification panels or pop-ups on the page.

web notification ui design, html notification popup, notification css, notification page design html, css notification box, notification ui html, notification design examples, jquery notification popup

Key Features:

  • 3 attributes: minimum, intensive, and default
  • Animations fade and slide.
  • Auto rejects after times out just like Android toast.
  • 5 types of notifications: Default, Warning, Success, Information, and Error.
  • Countdown progress bar.
  • Dedicated stand. The built-in mode is also supported.

Easy To Customize jQuery Notification Message Plugin | cosyAlert

How to make use of it:

1. Install the library with NPM.

# NPM
$ npm i polipop

2. Import the Polipop.js.

import Polipop from 'polipop';
// Core stylesheet
@import "node_modules/polipop/src/sass/core";
// Default theme
@import "node_modules/polipop/src/sass/default";
// Minimal theme
@import "node_modules/polipop/src/sass/minimal";
// Compact theme
@import "node_modules/polipop/src/sass/compact";

3. Or insert the next JavaScript and CSS files into the doc.

// Core JavaScript
<script src="/polipop/dist/polipop.min.js"></script>
// Core stylesheet
<link rel="stylesheet" href="/polipop/dist/css/polipop.core.min.css" />
// Default theme
<link rel="stylesheet" href="/polipop/dist/css/polipop.default.min.css" />
// Minimal theme
<link rel="stylesheet" href="/polipop/dist/css/polipop.minimal.min.css" />
// Compact theme
<link rel="stylesheet" href="/polipop/dist/css/polipop.compact.min.css" />

4. Create a new instance of the Polipop and specify the id of the component on which you need to instantiate the Polipop instance.

var polipop = new Polipop('myContainer', {
    // options here
});

5. Display a primary notification on the web page.

polipop.add({

  // notification content
  content: 'Basic Notification.',

  // notification title
  title: 'Title',

  // default, info, success, warning or error
  type: 'default',

});

6. The default configuration options.

var polipop = new Polipop('myContainer', {
    /**
     * A DOM element or selector string representing the element where the Polipop
     * wrapper element will be appended to. Can only be set on class instantiation.
     *
     * @type {String}
     */
    appendTo: 'body',

    /**
     * The BEM block name which is used for generating css classes for all elements
     * within the wrapper element. Can only be set on class instantiation.
     *
     * @type {String}
     */
    block: 'polipop',

    /**
     * The position of the wrapper element within the viewport. Can only be set on
     * class instantiation. Accepted values:
     * - 'top-left'
     * - 'center'
     * - 'top-right'
     * - 'inline'
     * - 'bottom-right'
     * - 'bottom-left'
     *
     * @type {String}
     */
    position: 'top-right',

    /**
     * The layout of the Polipop wrapper. Can only be set on class instantiation.
     * Accepted values:
     * - 'popups'
     * - 'panel'
     *
     * @type {String}
     */
    layout: 'popups',

    /**
     * The css theme of the Polipop wrapper. Can only be set on class instantiation.
     * Accepted values:
     * - 'default'
     * - 'compact'
     * - 'minimal'
     * - or any custom theme
     *
     * @type {String}
     */
    theme: 'default',

    /**
     * A boolean designating whether each notification element displays an icon,
     * according to the notification type.
     *
     * @type {Boolean}
     */
    icons: true,

    /**
     * Designates whether a notification element should be appended or prepended to the
     * notifications container. Accepted values:
     * - 'after'
     * - 'before'
     *
     * @type {String}
     */
    insert: 'after',

    /**
     * The vertical spacing between the notification elements. Can only be set on class
     * instantiation.
     *
     * @type {Number}
     */
    spacing: 10,

    /**
     * Limits the number of concurrent notification elements that can be rendered
     * within the notifications container at any given time. A value of '0' means
     * that there is no limit.
     *
     * @type {Number}
     */
    pool: 0,

    /**
     * A boolean designating whether the notification elements should be removed
     * automatically when they expire or whether they should stay in the DOM until
     * they are removed manually.
     *
     * @type {Boolean}
     */
    sticky: false,

    /**
     * Expiration time for non-sticky notification elements in milliseconds.
     *
     * @type {Number}
     */
    life: 3000,

    /**
     * A boolean designating whether the life time progress bar will be displayed for
     * each notification element.
     *
     * @type {Boolean}
     */
    progressbar: false,

    /**
     * A boolean designating whether the notifications expiration control should pause
     * when hovering over the wrapper element. Can only be set on class instantiation.
     *
     * @type {Boolean}
     */
    pauseOnHover: true,

    /**
     * The text that is displayed inside the 'panel' layout header. Can only be set on
     * class instantiation.
     *
     * @type {String}
     */
    headerText: 'Messages',

    /**
     * A boolean designating whether the closer button element will be displayed when
     * there are rendered notification elements. Can only be set on class
     * instantiation.
     *
     * @type {Boolean}
     */
    closer: true,

    /**
     * The text that is displayed inside the closer button element when the
     * notifications queue is empty.
     *
     * @type {String}
     */
    closeText: 'Close',

    /**
     * The text that is displayed inside the closer button element when the
     * notifications queue contains queued notification objects.
     *
     * @type {String}
     */
    loadMoreText: 'Load more',

    /**
     * A boolean designating whether the 'panel' layout wrapper element will be hidden
     * when there are no rendered notification elements.
     *
     * @type {Boolean}
     */
    hideEmpty: false,

    /**
     * The time, in milliseconds, the timer should delay in between executions of the
     * _loop function. Can only be set on class instantiation.
     *
     * @type {Number}
     */
    interval: 250,

    /**
     * The animation effect when adding or removing notification elements.
     * Accepted values:
     * - 'fade'
     * - 'slide'
     *
     * @type {String}
     */
    effect: 'fade',

    /**
     * The rate of the animation's change over time. Accepted values:
     * - 'linear'
     * - 'ease'
     * - 'ease-in'
     * - 'ease-out'
     * - 'ease-in-out'
     * - or a custom 'cubic-bezier' value
     *
     * @type {String}
     */
    easing: 'linear',

    /**
     * The number of milliseconds each iteration of the animation takes to complete.
     *
     * @type {Number}
     */
    effectDuration: 250,
});

7. Callback capabilities.

var polipop = new Polipop('myContainer', {
    /**
     * A callback function invoked immediately after the wrapper element has been
     * rendered into the DOM.
     *
     * @type {function()}
     */
    ready: function () {},

    /**
     * A callback function invoked immediately after a notification object has been
     * added into the queue. The notification object is passed to the function as
     * argument.
     *
     * @type {function(object)}
     */
    add: function () {},

    /**
     * A callback function invoked immediately before a notification element has been
     * rendered into the DOM. The notification object and the notification element are
     * passed to the function as arguments.
     *
     * @type {function(object, Element)}
     */
    beforeOpen: function () {},

    /**
     * A callback function invoked immediately after a notification element has been
     * rendered into the DOM but before the element's opening animation has started.
     * The notification object and the notification element are passed to the function
     * as arguments.
     *
     * @type {function(object, Element)}
     */
    open: function () {},

    /**
     * A callback function invoked immediately after a notification element has been
     * rendered into the DOM and the element's animation has finished. The notification
     * object and the notification element are passed to the function as arguments.
     *
     * @type {function(object, Element)}
     */
    afterOpen: function () {},

    /**
     * A callback function invoked immediately after the 'Polipop.beforeClose' event
     * has been triggered on an element but before the element's closing animation has
     * started. The notification object and the notification element are passed to the
     * function as arguments.
     *
     * @type {function(object, Element)}
     */
    beforeClose: function () {},

    /**
     * A callback function invoked immediately after the element's closing animation
     * has finished, immediately before the element has been removed from the DOM. The
     * notification object and the notification element are passed to the function as
     * arguments.
     *
     * @type {function(object, Element)}
     */
    close: function () {},

    /**
     * A callback function invoked immediately after a notification element has been
     * clicked. The MouseEvent, the notification object and the notification element
     * are passed to the function as arguments.
     *
     * @type {function(MouseEvent, object, Element)}
     */
    click: function () {},
});

8. API strategies.

// update option
polipop.setOption(key, value);

// get option
polipop.getOption(key, value);

// enable
polipop.enable();

// disable
polipop.disable();

// pause
polipop.pause();

// unpause
polipop.unpause();

// close all
polipop.closeAll();

// delete all notification objects from the queue
polipop.emptyQueue();

// destroy
polipop.destroy();

Building

Build using NPM scripts. The following scripts are available:

  • build:css – Builds CSS files from SCSS files.
  • build:js – Builds JavaScript files.
  • build – Builds all JavaScript and CSS files.
  • lint – Lints source and built JavaScript files.

Configuration options

OptionTypeDescription
appendToStringDefault: body
A DOM element or selector string representing the element where the Polipop wrapper element will be appended to. Can only be set on class instantiation.
blockStringDefault: polipop
The BEM block name which is used for generating css classes for all elements within the wrapper element. Can only be set on class instantiation.
positionStringDefault: top-right
The position of the wrapper element within the viewport. Can only be set on class instantiation.
Accepted values: top-leftcentertop-rightbottom-rightbottom-left or inline.
layoutStringDefault: popups
The layout of the Polipop wrapper. Can only be set on class instantiation.
Accepted values: popups or panel.
themeStringDefault: default
The css theme of the Polipop wrapper.
Accepted values: default or any custom theme.
insertStringDefault: after
Designates whether a notification element should be appended or prepended to the notifications container.
Accepted values: after or before.
spacingNumberDefault: 10
The vertical spacing between the notification elements. Can only be set on class instantiation.
poolNumberDefault: 0
Limits the number of concurrent notification elements that can be rendered within the notifications container at any given time. A value of 0 means that there is no limit.
stickyBooleanDefault: false
A boolean designating whether the notification elements should be removed automatically when they expire or whether they should stay in the DOM until they are removed manually.
lifeNumberDefault: 3000
Expiration time for non-sticky notification elements in milliseconds.
pauseOnHoverBooleanDefault: true
A boolean designating whether the notifications expiration control should pause when hovering over the wrapper element.
headerTextStringDefault: Messages
The text that is displayed inside the panel layout header. Can only be set on class instantiation.
closerBooleanDefault: true
A boolean designating whether the closer button element will be displayed when there are rendered notification elements. Can only be set on class instantiation.
closeTextStringDefault: Close
The text that is displayed inside the closer button element when the notifications queue is empty.
loadMoreTextStringDefault: Load more
The text that is displayed inside the closer button element when the notifications queue contains queued notification objects.
hideEmptyBooleanDefault: false
A boolean designating whether the ‘panel’ layout wrapper element will be hidden when there are no rendered notification elements.
intervalNumberDefault: 250
The time, in milliseconds, the timer should delay in between executions of the _loop function. Can only be set on class instantiation.
effectStringDefault: fade
The animation effect when adding or removing notification elements.
Accepted values: fade or slide.
easingStringDefault: linear
The rate of the animation’s change over time.
Accepted values: lineareaseease-inease-outease-in-out or a custom cubic-bezier value.
effectDurationNumberDefault: 250
The number of milliseconds each iteration of the animation takes to complete.
readyfunction()A callback function invoked immediately after the wrapper element has been rendered into the DOM.
addfunction(object)A callback function invoked immediately after a notification object has been added into the queue. The notification object is passed to the function as argument.
beforeOpenfunction(object, Element)A callback function invoked immediately before a notification element has been rendered into the DOM. The notification object and the notification element are passed to the function as arguments.
openfunction(object, Element)A callback function invoked immediately after a notification element has been rendered into the DOM but before the element’s opening animation has started. The notification object and the notification element are passed to the function as arguments.
afterOpenfunction(object, Element)A callback function invoked immediately after a notification element has been rendered into the DOM and the element’s animation has finished. The notification object and the notification element are passed to the function as arguments.
beforeClosefunction(object, Element)A callback function invoked immediately after the Polipop.beforeClose event has been triggered on an element but before the element’s closing animation has started. The notification object and the notification element are passed to the function as arguments.
closefunction(object, Element)A callback function invoked immediately after the element’s closing animation has finished, immediately before the element has been removed from the DOM. The notification object and the notification element are passed to the function as arguments.
clickfunction(EventTarget, object, Element)A callback function invoked immediately after a notification element has been clicked. The EventTarget, the notification object and the notification element are passed to the function as arguments.

Properties

A Polipop instance has the following public properties:

options

Type: Object

Default: Default configuration options

The default configuration options merged with instance options.

queue

Type: Array

Default: []

An array containing the queued notification objects.

elements

Type: HTMLCollection | null

Default: null

An object containing a collection of rendered notification elements.

wrapperHeight

Type: Number

Default: 0

The height of the wrapper element.

OptionTypeDescription
typeStringThe notification type.
Accepted values: defaultinfosuccesswarning or error.
titleStringThe notification title.
contentStringThe notification content.

Modern Notification Popup & Panel JavaScript Library, Polipop Plugin/Github


See Demo And Download

Official Website(minitek): Click Here

This superior jQuery/javascript plugin is developed by minitek. For extra Advanced Usages, please go to the official website.

Related Posts

Iconpicker-Bootstrap-5

[Icon Picker] Iconpicker for Bootstrap 5 Icons Library

Bootstrap 5-based icon picker which supports any icon libraries like Bootstrap Icons, Font Awesome[fontawesome.com], etc. Must Read: 1000+ Pixel Perfect SVG Icons For Vue Components | Unicons How…

bootstrap-multiple-image-upload-with-preview

Bootstrap Multiple Image Upload with Preview and Delete | ImagesLoader

ImagesLoader is a standard bootstrap image upload plugin that provides an easy-to-use and nice-looking interface for uploading multiple images to a web server. Must Read: HTML 5…

Animating-Split-Flap-Displays-fallblatt

A Lightweight jQuery Plugin for Animating Split-Flap Displays | fallblatt

fallblatt is a lightweight jQuery plugin for animating split screens. This jQuery plugin allows you to include such offers in your web application. Everything from virtual departure…

bootstrap-5-dark-theme

Dark & Light Switch Mode Toggle for Bootstrap 5

Switching to dark mode is done by toggling HTML tags that include -dark or -light as a category. It is made by manipulating the DOM with JavaScript. The text color also changes depending…

jQuery-SyoTimer-Plugin

jQuery Plugin for Countdown Timer on HTML Page | SyoTimer

yoTimer jQuery plugin allows you to create digital style countdowns/periodic timers on the webpage, with callbacks support and timezone/translation customization. Features Periodic count with the specified period…

vue-js-periodic-table

Dynamic, Data-driven Periodic Table built with Vue.js

Periodicity is a dynamic, data-driven periodic table created with Vue.js that uses D3 animations and graphs to show the beauty of periodic trends. Built With vue.js (component…