All Projects → robiveli → jpopup

robiveli / jpopup

Licence: MIT license
Simple lightweight (<2kB) javascript popup modal plugin

Programming Languages

javascript
184084 projects - #8 most used programming language
HTML
75241 projects
SCSS
7915 projects

Projects that are alternatives of or similar to jpopup

eins-modal
Simple to use modal / alert / dialog / popup. Created with pure JS. No javascript knowledge required! Works on every browser and device! IE9
Stars: ✭ 30 (+11.11%)
Mutual labels:  modal, vanilla-javascript, popup, modal-plugin
plain-modal
The simple library for customizable modal window.
Stars: ✭ 21 (-22.22%)
Mutual labels:  simple, modal, popup
Beedle
A tiny library inspired by Redux & Vuex to help you manage state in your JavaScript apps
Stars: ✭ 329 (+1118.52%)
Mutual labels:  lightweight, vanilla-javascript
Qview
Practical and minimal image viewer
Stars: ✭ 460 (+1603.7%)
Mutual labels:  lightweight, simple
musicWebTemplate
Free website template built for musicians / artists to promote their music and connect to their audience.
Stars: ✭ 26 (-3.7%)
Mutual labels:  modal, modal-plugin
Autocomplete.js
Simple autocomplete pure vanilla Javascript library.
Stars: ✭ 3,428 (+12596.3%)
Mutual labels:  lightweight, vanilla-javascript
Darkmode Js
DarkModeJS helps you to auto detect user's time and switch theme to darkside
Stars: ✭ 328 (+1114.81%)
Mutual labels:  lightweight, vanilla-javascript
Splide
Splide is a lightweight, powerful and flexible slider and carousel, written in pure JavaScript without any dependencies.
Stars: ✭ 786 (+2811.11%)
Mutual labels:  lightweight, vanilla-javascript
MatrixLib
Lightweight header-only matrix library (C++) for numerical optimization and machine learning. Contact me if there is an exciting opportunity.
Stars: ✭ 35 (+29.63%)
Mutual labels:  lightweight, simple
Htmr
Simple and lightweight (< 2kB) HTML string to React element conversion library
Stars: ✭ 214 (+692.59%)
Mutual labels:  lightweight, simple
Bonsai
🌱 a tiny distro-independent package manager
Stars: ✭ 188 (+596.3%)
Mutual labels:  lightweight, simple
simple-jwt-provider
No description or website provided.
Stars: ✭ 33 (+22.22%)
Mutual labels:  lightweight, simple
picamera-motion
Raspberry Pi python PiCamera Lightweight Motion Detection. Includes easy curl script install/upgrade, whiptail admin menu system, single file web server and Rclone for uploading to a variety of web storage services.
Stars: ✭ 80 (+196.3%)
Mutual labels:  lightweight, simple
zoom
Lightweight (8 Kb) ES5 javascript plugin without any dependencies, compatible with desktop and mobile devices.
Stars: ✭ 25 (-7.41%)
Mutual labels:  lightweight, vanilla-javascript
Wondercms
WonderCMS - fast and small flat file CMS (5 files)
Stars: ✭ 330 (+1122.22%)
Mutual labels:  lightweight, simple
got
An enjoyable golang test framework.
Stars: ✭ 234 (+766.67%)
Mutual labels:  lightweight, dependency-free
Glide
A dependency-free JavaScript ES6 slider and carousel. It’s lightweight, flexible and fast. Designed to slide. No less, no more
Stars: ✭ 6,256 (+23070.37%)
Mutual labels:  lightweight, dependency-free
react-layer-stack
Layering system for React. Useful for popover/modals/tooltip/dnd application
Stars: ✭ 158 (+485.19%)
Mutual labels:  modal, popup
cli
a lightweight and simple cli package
Stars: ✭ 12 (-55.56%)
Mutual labels:  lightweight, simple
tb-grid
tb-grid is a super simple and lightweight 12 column responsive grid system utilizing css grid.
Stars: ✭ 19 (-29.63%)
Mutual labels:  lightweight, simple

jPopup

Simple lightweight (<2kB) and easy-to-use javascript popup plugin

Another popop?

Yep, I needed simple as possible popup plugin for personal use, so jPopup was born.

Demo

Demo available here.

Install

With npm:

npm install jpopup --save

Usage

Include required javascript:

import jPopup from 'jPopup';

Optionally, include stylings (or style it as you wish):

@import 'jPopup';

Define new instance and open popup:

<script>
    var myPopup = new jPopup({ // initialize jPopup
    	content: '<p>Lorem Ipsum...</p>'
        transition: 'fade',
        onOpen: function ($popupElement) {
            console.log('popup open');
        },
        onClose: function ($popupElement) {
            console.log('popup closed');
        }
    });

    myPopup.open(); // open popup
</script>

And that's that! Now you should see HTML markup in document tree:

<div class="jPopup jPopup--fade">
    <button type="button" class="jPopup-closeBtn"></button>
    <div class="jPopup-content"><p>Lorem Ipsum...</p></div>
</div>

Options

jPopup can take just several parameters - an object of key/value settings:

Name Required Type Default Description
content true [String] '' Content to display
transition false [String] 'fade' Type of appearance animation. Possible animation transitions: 'fade', 'slideInFromTop', 'slideInFromBottom', 'slideInFromLeft' and 'slideInFromRight'
onOpen false [Function] null Callback to execute when popup is open, returned argument is popup (type: Element)
onClose false [Function] null Callback to execute when popup is closed, returned argument is popup (type: Element)

API

open() - open popup

close() - close popup

setContent(content) - set popup content (@param {String})

getContent() - get popup content (@return {String})

destroy() - destroy popup (remove from DOM and unbind events)

Browser support

It works in every modern browser.


License

jPopup is licensed under the MIT license.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].