
Security News
vlt Launches "reproduce": A New Tool Challenging the Limits of Package Provenance
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
@springernature/global-popup
Advanced tools
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.
There are two approaches for using Global Popup:
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 attribute | Type | Description |
---|---|---|
data-popup | Boolean | This is the popup trigger i.e. clicking this will open a popup |
data-popup-target | String | This 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 attribute | Type | Description |
---|---|---|
data-popup-min-width | String | Sets a min-width in css on the popup, e.g. "100px" |
data-popup-max-width | String | Sets a max-width in css on the popup, e.g. "600px" |
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>
If you wish to lazily create a popup the first time the trigger is clicked - for example if building the html for your popup is an expensive operation that you'd like to defer until needed - you can use this pattern:
import {Popup} from 'global-popup/js/popup';
const trigger = document.querySelector('span');
trigger.addEventListener('click', function() {
const popup = new Popup(trigger, 'popupContent1');
popup.open();
}, {capture: false, once: true});
<div>
<span>Popup trigger</span>
<div id="popupContent1">
<p>Some popup text</p>
</div>
</div>
FAQs
Builds and styles a popup that can be opened and closed
The npm package @springernature/global-popup receives a total of 1,481 weekly downloads. As such, @springernature/global-popup popularity was classified as popular.
We found that @springernature/global-popup demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 14 open source maintainers collaborating on the project.
Did you know?
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.
Security News
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.