New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

simplemodal

Package Overview
Dependencies
Maintainers
4
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

simplemodal

A simple modal popup plugin

  • 1.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
8
decreased by-42.86%
Maintainers
4
Weekly downloads
 
Created
Source

Simple Modal

A Javascript plugin to save rewriting modal popup code over and over.

Core functionality

This plugin should:

  • Build a modal element and add it to the page
  • Add any classes specified in the className option to the modal
  • If the closeButton option is true, add a close button
  • If the content option is a HTML string, set it as the modal’s content
  • If the content option is a domNode, set it’s interior content as the modal’s content
  • Set the modal’s maxWidth and minWidth respectively
  • Add an overlay if the overlay option is true
  • When opened, add a modal-open class that we can use with our CSS to define an open state.
  • When closed, remove the modal-open class.
  • If the modal’s height exceeds the viewport’s height, also add a modal-anchored class so that we can handle that scenario

Road map

  • Add the ability to close modal with ESC key
  • Add library of animations that can be added to the popup
  • Be able to customize close button

Usage

var Modal = require('simplemodal');
var myModal = new Modal({

  // Can be a string or reference an ID
  content: myContent,

  // Defaults
  className: 'fade-and-drop',
  closeButton: true,
  maxWidth: 600,
  minWidth: 280,
  overlay: true
});

Settings

OptionTypeDefaultDescription
classNamestring'fade-and-drop'Adds animation class
closeButtonbooleantrueTurns close button on/off
maxWidthint600Sets max width of modal
minWidthint280Sets min width of modal
overlaybooleantrueTurns overlay on/off

Keywords

FAQs

Package last updated on 12 Jan 2018

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