Dynamic Bootstrap Modal Plugin With jQuery - Modal Manager

File Size: 5.17 KB
Views Total: 2103
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   
Dynamic Bootstrap Modal Plugin With jQuery - Modal Manager

A very smalll jQuery plugin that makes it easier to create dynamic Bootstrap modal windows directly in the JavaScript.

How to use it:

1. The plugin requires jQuery and Bootstrap loaded correctly in the html page.

<link rel="stylesheet" href="/path/to/bootstrap.min.css">
<script src="/path/to/jquery.min.js"></script>
<script src="/path/to/bootstrap.min.js"></script>

2. Load the boostrapModalManager.js script after jQuery library.

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

3. Create a basic Bootstrap modal window with default action buttons that will auto popup on page load.

$('body').bootstrapModalManager();

4. Customize the modal window with the following options & callbacks.

$('body').bootstrapModalManager({
  sections: {
    head: {
      text: 'Test title',
      buttons: []
    },
    body: {
      text: 'A body of text.'
    },
    footer: {
      buttons: [
        {
          classes: ['btn-default'],
          text: 'Close',
          action: null
        },
        {
          classes: ['btn-primary'],
          text: 'Save Changes',
          action: null
        }
      ]
    }
  }
});

This awesome jQuery plugin is developed by stuartmcg123. For more Advanced Usages, please check the demo page or visit the official website.