![require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages](https://cdn.sanity.io/images/cgdhsj6q/production/be8ab80c8efa5907bc341c6fefe9aa20d239d890-1600x1097.png?w=400&fit=max&auto=format)
Security News
require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
A lightweight, accessible, vanilla JavaScript modal component.
https://romanslonov.github.io/pure-modal/
<div class="modal" id="modal1" role="dialog" aria-labelledby="modal-1" aria-describedby="basic-modal" tabindex="-1" style="display: none;">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">Modal title 1</h5>
<button type="button" class="modal-close" data-dismiss="modal" aria-label="Close">
<svg width="16" height="16" viewBox="0 0 40 40">
<path stroke-linecap="round" class="close-x" d="M 10,10 L 30,30 M 30,10 L 10,30" stroke="#000" fill="transparent" stroke-width="5"></path>
</svg>
</button>
</div>
<div class="modal-body">
Content of modal 1
</div>
<div class="modal-footer">
<div class="mr-xs">
<button data-dismiss="modal" aria-label="Close">Close</button>
</div>
<button>Save changes</button>
</div>
</div>
</div>
</div>
const modal1 = new Modal('modal1');
modal1.init();
<button data-toggle="modal" data-target="modal1">Modal 1</button>
Name | type | Default | Description |
---|---|---|---|
transition | Boolean | true | Initialize PureModal instance. Add event listeners. |
beforeOpen | Function | null | A callback that will be called before opening the modal. |
onOpen | Function | null | A callback that will be called after the modal is fully opened. |
beforeClose | Function | null | A callback that will be called before closing the modal. |
onClose | Function | null | A callback that will be called after the modal is fully closed. |
Name | Description |
---|---|
init() | Initialize PureModal instance. Add event listeners. |
destroy() | Destroy all event listeners. Useful when building SPA. |
open() | Call to open modal manually. |
close() | Call to close modal manually. |
FAQs
A lightweight, accessible, vanilla JavaScript modal component
The npm package pure-modal receives a total of 34 weekly downloads. As such, pure-modal popularity was classified as not popular.
We found that pure-modal demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
Security News
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.