Skip to content
This repository has been archived by the owner on May 26, 2020. It is now read-only.
/ uModal Public archive

The skeleton of a modal management tool. Abandoned for now. Perhaps another day.

License

Notifications You must be signed in to change notification settings

sean0x42/uModal

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

uModal

uModal is a powerful modal management tool with zero dependencies.

Basic Usage

  1. Download the latest version of uModal.

  2. Add uModal to your page.

    <head>
        ...
        <link rel="stylesheet" href="path/to/uModal.css">
    </head>
    
    <body>
        ...
        <script src="path/to/uModal.min.js"></script>
    </body>
  3. To create the most basic modal possible, simply use:

    uModal.create("Modal title.", "Modal body.");

Advanced Usage

Modal Types

uModal provides a number of different modal types.

  • Normal
  • Warning
  • Error

Define a modal type by using the following:

uModal.create(title, body, uModal.type.WARNING);

Buttons

uModal gives you complete control over a modal's buttons. Simply create an array of any buttons you wish to add.

var buttons = [
    uModal.createButton("Ok")
];

uModal.create(title, body, uModal.type.NORMAL, buttons);

By default, a button will close its parent modal when clicked. uModal allows you to change this by specifying a different action. A full list of available actions can be found here.

uModal.createButton("Close", uModal.buttonAction.CLOSE);

If you need a little more flexibility, you can also use a function.

uModal.createButton("Help", showHelpFunction);

// or

uModal.createButton("Help", function(event) { ... });

Options

There are a number of options available to help customise your modals. Options can be defined using:

var options = {
    closeOnBackgroundClick: true
};

uModal.create(title, body, uModal.type.NORMAL, buttons, options);

The following options are available for use:

Option Type Description
closeOnBackgroundClick boolean Closes the modal if the user clicks on the background.
closeModalOnButtonClick boolean Automatically closes the modal if a button is clicked.

About

The skeleton of a modal management tool. Abandoned for now. Perhaps another day.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published