popup-js

About

A sleek and highly customizable JavaScript library for generating full-screen infographic popups with minimal effort.

From warnings, through instructions, to confirmation popups, popup-js covers a wide range of use cases.

Installation

To add popup-js to your web application, add the following code snippet before your script.

<script src="https://cdn.jsdelivr.net/npm/@simondmc/popup-js@1.4.3/popup.min.js"></script>

Quickstart

Create a new popup by instantiating the Popup class:

const myPopup = new Popup({
    id: "my-popup",
    title: "My First Popup",
    content: `
        An example popup.
        Supports multiple lines.`,
});

Display a popup on page load with the showImmediately parameter:

const myPopup = new Popup({
    ...
    showImmediately: true
});

or display it with a fade-in using the .show() method:

button.addEventListener('click', () => {
    myPopup.show();
});

Check out the documentation for a comprehensive list of parameters and methods.