An open API service indexing awesome lists of open source software.

https://github.com/persianturtle/popupjs

A minimalistic popup library made for designers & developers.
https://github.com/persianturtle/popupjs

interstitials javascript lightbox minimalist modal popup

Last synced: about 1 year ago
JSON representation

A minimalistic popup library made for designers & developers.

Awesome Lists containing this project

README

          

# Demo

View examples here: https://persianturtle.github.io/popupjs/

# Philosphy & Goals

Are you comfortable writing CSS/JS? This popup library is for you!

The goals for this project are to:

1. **make styling easy** without needing to overwrite a bunch of CSS
2. **allow custom functionality** with access to the raw `event` that triggered a popup's opening/closing
3. **have no dependencies** with support for modern browsers
4. **handle the basic stuff** like animations, overlays and preventing body scrolling while open

# Features

- Allows custom functions to be executed before/after opening/closing with access to the `event` that triggered a popup's opening/closing

- Opening & closing animations

- Disable `body` scrolling when a popup is open

- Automatically closes existing popups before opening new ones

- Easy styling with minimum default styles

- Can be used for all types of popups (see examples)

# Getting Started

1. Include both `popup.js` and `popup.css`. Both, combined is around 1kb minified & gzipped.
2. Include a popup's HTML with the following wrapper:

3. Register the popup by calling the register function:

window.popup.register("className")

4. Add custom CSS for your popup. This library provides almost no default styling. It does handle the popup animation as well as the tinted overlay. The rest is up to you!
5. See the "Usage & Options" section below for all available options.

# API

This library exposes three functions:

1. `window.popup.register(_className[, options]_)`

**Parameters:**

`className`

_string_

By default, the class name of the popup element: