Categories: CSSScriptWeb Design

Lightweight Fullscreen Popup Library – jpopup

jpopup is a super small JavaScript popup plugin that allows to display any HTML element in a responsive fullscreen modal window.

Install the jpopup:

# NPM
$ npm install jpopup

# Bower
$ bower install jpopup

How to use it:

1. Import the jpopup’s JavaScript and CSS files into the document.

// As A Module
import jPopup from 'jPopup';
<link href='css/index.min.css' rel='stylesheet'>
<script src="js/index.min.js"></script>

2. Create a new jPopup and define your own content to be displayed in the popup.

var jPopupDemo = new jPopup({
    content: 'any html content here'
});

3. Determine the transition effects: ‘fade’ (default), ‘slideInFromTop’, ‘slideInFromBottom’, ‘slideInFromLeft’, or ‘slideInFromRight’.

var jPopupDemo = new jPopup({
    transition: 'fade'
});

4. Callback functions.

var jPopupDemo = new jPopup({
    onOpen: function ($popupEl) {
      console.log($popupEl, 'open');
    },
    onClose: function ($popupEl) {
      console.log($popupEl, 'close');
    }
});

Open/close the popup manually:

jPopupDemo.open();
jPopupDemo.close();

Set & update popup content:

jPopupDemo.setContent(content);
jPopupDemo.getContent();

Destroy the instance.

jPopupDemo.destroy();

Customize the popup in the SASS:

// Base Breakpoint
$baseBreakpoint: 680px;

// Background Color
$bgColor: #fff;

// Close Button Color
$closeBtnColor: #adadad;

Changelog:

v2.0.1 (06/20/2025)

  • update

v2.0.0 (05/31/2020)

  • new API methods
  • remove History API support
  • drop support for IE10
  • main files rename
  • popup open() initialized manually
  • new appearance transitions
  • new CSS class naming
  • no need for polyfills

01/02/2020

  • v1.3.1: API updated

09/29/2018

  • v1.2.1: minor updates.

The post Lightweight Fullscreen Popup Library – jpopup appeared first on CSS Script.

rssfeeds-admin

Share
Published by
rssfeeds-admin

Recent Posts

Today’s Top Deals: Ninja Gaiden: Ragebound for Switch, LEGO Sets, and an Xbox Gift Card

If you’re after some new games for your Switch 2, you’re in luck, as Ninja…

23 minutes ago

Pokémon Fan Funds Wedding With $44,000 Charizard Card Sale

A Pokémon fan has been able to fund his own wedding, after rediscovering a trio…

23 minutes ago

The Beginner-Friendly DJI Mini 4K Drone Fly More Combo With Extra Batteries Has a 30% Price Drop

The DJI Mini 4K is an excellent quadcopter drone camera for beginners looking to try…

23 minutes ago

Handle Long Press/Tap Event In JavaScript – long-press-event

long-press.js is a small JavaScript library which detects and handles the long press/tap event on…

59 minutes ago

The art of honest conversation: the one shift that makes people finally feel heard

Tension: We perform listening instead of practicing presence, creating distance while appearing close. Noise: The…

1 hour ago

The leadership style that worked in 2010 is actively damaging teams in 2026

Tension: The command-and-control leadership that built successful companies in 2010 now creates anxious, depleted teams.…

1 hour ago

This website uses cookies.