Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@springernature/global-popup

Package Overview
Dependencies
Maintainers
11
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@springernature/global-popup

Builds and styles a popup that can be opened and closed

  • 2.0.0
  • npm
  • Socket score

Version published
Weekly downloads
4.2K
increased by42.44%
Maintainers
11
Weekly downloads
 
Created
Source

Global Popup

Click a trigger element to build and display a popup. Popups are built from existing html in the DOM and require it to be there prior to initialisation.

Popups are absolutely positioned either above or below the trigger, based on a calculation of space in the viewport. Defaults to above. By default the popups calculate their width based on their contents.

Usage

There are two approaches for using Global Popup:

  1. Data attribute API
  2. Directly in your application
Data attribute API
import {popup} from 'global-popup/js';

popup();
<span data-popup data-popup-target="popupContent1">Popup trigger</span>
<div id="popupContent1">
    <p>Some popup text</p>
</div>

Two data attributes are required:

Data attributeTypeDescription
data-popupBooleanThis is the popup trigger i.e. clicking this will open a popup
data-popup-targetStringThis is the id of the element in the DOM that Global Popup will use to build the popup contents

There are also options (add these to trigger element):

Data attributeTypeDescription
data-popup-min-widthStringSets a min-width in css on the popup, e.g. "100px"
data-popup-max-widthStringSets a max-width in css on the popup, e.g. "600px"
Directly
import {Popup} from 'global-popup/js/popup';

const trigger = document.querySelector('span');
new Popup(trigger, 'popupContent1', { MIN_WIDTH: "100px", MAX_WIDTH: "600px" });
<div>
    <span>Popup trigger</span>
    <div id="popupContent1">
        <p>Some popup text</p>
    </div>
</div>		

FAQs

Package last updated on 20 Oct 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc