Open Modal Dialog Popup Using JavaScript plugin | modal.js

modal.js is a JavaScript library that renders a class to easily create modal windows.

open modal popup using jquery on button click, jquery modal popup, javascript modal popup, dialog / popup javaScript plugin

How to make use of it:

1. Add your content with an icon close to the modal window.

<div id="messageBox">
  <i class="close">x</i>
  <p>Modal Content Here</p>

2. Create a button to toggle the modal window.

<button type="button" data-modal="messageBox">Open Modal</button>

3. Load the main modal.js JavaScript at the end of the document.

<script src="assets/js/modal.js"></script>

4. Hide the modal window in the init.

#messageBox {
  display: none;

5. Modal window style. {
  display: block;
  position: fixed;
  top: 50%;
  left: 50%;
  right: 0;
  max-width: 480px;
  padding: 0 20px;
  background-color: #fff;
  box-shadow: 0 5px 15px rgb(0 0 0 / 15%);
  transform: translate(-50%);
  z-index: 999;

6. Close icon style.

.close {
  position: absolute;
  top: -15px;
  right: -15px;
  width: 30px;
  height: 30px;
  background-color: #fff;
  box-shadow: 0 5px 8px rgb(0 0 0 / 15%);
  border-radius: 50%;
  text-align: center;
  font-size: 18px;
  line-height: 30px;
  font-family: Arial;
  font-style: normal;
  cursor: pointer;

Minimal Modal Window JavaScript, modal.js Plugin/Github

See Demo And Download

Official Website(enamul-hoque): Click Here

This superior jQuery/javascript plugin is developed by enamul-hoque. For extra Advanced Usages, please go to the official website.

Leave a Comment