Ultra-light JavaScript Dialog & Modal Plugin – JSmodal

Category: Javascript , Modal & Popup | January 28, 2020
Author: MLeidel
Views Total: 271 views
Official Page: Go to website
Last Update: January 28, 2020
License: MIT

Preview:

Ultra-light JavaScript Dialog & Modal Plugin – JSmodal

Description:

An ultra-light popup box plugin to create minimal clean, non-blocking confirm/prompt dialog boxes and modal windows on the page.

How to use it:

1. Insert the JavaScript JSmodal.min.js and Stylesheet JSmodal.min.css into the HTML file.

<script src="JSmodal.min.js"></script>
<link rel="stylesheet" href="JSmodalani.css" />

2. Create a basic modal window.

JSmodal.open(0,'Hello World!');

// allows to close the modal by click outside
JSmodal.open(1,'Hello World!');

3. Create a confirmation dialog.

JSmodal.confirm("thisConfirm()", "Please confirm this");
function thisConfirm() {
  JSmodal.close();
  alert("Confirmed");
}

4. Create a prompt dialog.

JSmodal.prompt(`
  JSmodal.close();
  let val = document.getElementById('JSid').value;
  alert('prompted input: ' + val);`,
  "Please enter your email");

You Might Be Interested In:


Leave a Reply