A JavaScript Plugin For Creating And Managing Modals | Minitaur.js

minitaur is the ultimate, dependency-free, easy-to-use, JavaScript plugin for creating and managing modals/forms.

How to make use of it:

1. Download and import the Minitaur.js library into the document.

<script src="minitaur.js"></script>

2. Configure Minitaur.js.


3. The library automatically converts any element with the “minitaur” or “data-minitaur” class; Attribute in a modal window.

<div class="my-modal" 
     <p>Open On Page Load</p>
     <button type="button" data-minitaur-close>Close</button>

4. You can also create a modal window, which means you don’t have to create a modal item as shown above.

  content: '<p>Any Modal Content Here.</p>',
  mount: false,
  opened: true,
  style: {
    backgroundColor: '#fff',
    padding: '10px'
  takeover: true,

5. Mount the template to any item you provide.

// or
  mount: document.getElementById('customElement')

6. Full options to customize the modal.

  // Accepts a String that will be passed to document.querySelector, an HTMLElement, or an Object containing x and/or y keys set to the before mentioned types to have the modal base it's horizontal and vertical positions on two different elements.
  // If this (or either of the x/y object keys) is set to 'viewport', the currently visible viewport will be used, also the modal's position will automatically be updated when the user scrolls the page.
  // If this (or either of the x/y object keys) is set to null, it will default to document.body unless the modal was opened via a trigger in which case it will default to the element that initiated the triggered event.
  anchor: null,
  backdropClass: 'minitaur-backdrop',
  backdropClosingStyle: null,
  backdropOpeningStyle: null,
  backdropStyle: {
    backgroundColor: 'rgba(0, 0, 0, 0.5)'
  // An Object of options that are set depending on the browser window's width.
  breakpoints: null,
  class: 'minitaur',
  closeClass: 'closed',
  closeDuration: 0,
  closingClass: 'closing',
  closingStyle: null,
  closeOnFocusOut: true,
  closeStyle: {
    display: 'none',
    visibility: 'hidden'
  content: null,
  id: null,
  mount: '.minitaur, [data-minitaur]',
  opened: false,
  openClass: 'opened',
  openDuration: 0,
  openingClass: 'opening',
  openingStyle: {
    display: 'block',
    visibility: 'visible'
  openStyle: null,
  parameters: null,
  // 'left', 'inner-left', 'middle', 'inner-right', 'right', 'top', 'inner-top', 'middle', 'inner-bottom', 'bottom'
  position: 'middle', 
  respectAnchorSpacing: false,
  stayInBounds: true,
  style: null,
  // Set to true to have a backdrop added behind the modal and disable page scroll while the modal is open.
  takeover: false,
  // Custom trigger element
  triggers: [],

7. You can also pass options through HTML data attributes.

<div class="modal-style" 
     data-minitaur-position="top middle" 

8. Callback functions.

  afterClose: function (modal) {
    // do something
  afterInit: function (modal) {
    // do something
  afterOpen: function (modal) {
    // do something

9. API methods and properties.

// global methods
minitaur.kill('#myModal', false)
minitaur.open('#myModal', {
  // options
minitaur.set('#myModal', {
  // options

// instance methods
  // options
  // options

// properties

10. Events.

modal.addEventListener('open', function (e) {
  // do something

modal.addEventListener('close', function (e) {
  // do something

See Demo And Download

Official Website(kodie): Click Here

This superior jQuery/javascript plugin is developed by kodie. For extra Advanced Usage, please go to the official website.

Related Posts


CSS Layout Components Horizontal/Vertical Stack | HStack and VStack

HStack and VStack in CSS – CSS layout components that (basically) stack anything horizontally and vertically. A pure CSS library that makes it easy to stack elements…


How to Add Floating Whatsapp Chat Button In HTML | venom-button

Venom Button is a very simple plugin for the jQuery floating WhatsApp button. Adds a floating button to your site that calls WhatsApp Click to Chat API. It will automatically start the WhatsApp…


Interactive Data Table Generator with JS/jQuery and JSON | Tabulator

Tabulator allows you to create interactive tables in seconds from any HTML Table, JavaScript array, AJAX data source, or JSON format data. Just include the library in your…


Simple Alert, Confirm, Prompt Popup Using Vanilla JavaScript Library | attention.js

JavaScript provides various built-in functionality to display popup messages for different purposes. Attention JS is a vanillaJS plugin used to create a custom alert, confirm, or Prompt…


Bootstrap 4 Sidebar Menu Responsive Template | MDB

Bootstrap Side Navbar – Responsive sidebar template based on the Bootstrap 4 framework. An easy-to-use, totally responsive, Google Material Design impressed aspect navigation for modern web app…


Lightweight Bootstrap 4 Toast Notification Plugin | BS4 Advanced Toast

A lightweight Bootstrap 4 Toast Notification plugin integrated with JS/jQuery. bs4-toast.js is a JavaScript library that enhances the native Bootstrap toast component with icons, buttons, callbacks, and…

Leave a Reply

Your email address will not be published. Required fields are marked *