Latest Threat ResearchGlassWorm Loader Hits Open VSX via Developer Account Compromise.Details
Socket
Book a DemoInstallSign in
Socket

modal-element

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

modal-element

A basic modal element running on virtual dom

Source
npmnpm
Version
1.0.0
Version published
Maintainers
1
Created
Source

modal-element

A basic modal element built on a virtual DOM.

Example

var Modal = require('modal-element')
var modal = new Modal()

// Render the modal with child nodes
modal.render([
  modal.html('h3', 'Header'),
  modal.html('p', 'This is a modal')
])

// Call to open/close
modal.toggle()

Creates a HTML view like:

<div class="modal-overlay">
  <div class="modal">
    <h3>Header</h3>
    <p>This is a modal</p>
  </div>
</div>

API

var modal = new Modal(appendTo)

Creates a new modal element. appendTo is the parent DOM node to append to. Defaults to document.body.

modal.toggle()

Will hide or show modal.

modal.center(node)

Centers a DOM node passed to it.

modal.shown

Boolean whether the modal is shown.

modal.centerOnLoad

Boolean whether to automatically center the modal on load.

modal.modal

A {} containing properties for the child modal element.

Events

Listen for events with modal.on(name, function (param) {}).

  • load: Called when element has loaded.
  • toggle: Called when modal is shown or hidden.

license

(c) 2015 Kyle Robinson Young. MIT License

Keywords

virtual

FAQs

Package last updated on 16 May 2015

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