Dynamic Bootstrap 4 Modal Manager - jQuery bsModal

Dynamic Bootstrap 4 Modal Manager - jQuery bsModal
File Size: 173 KB
Views Total:
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   

Just another Bootstrap 4 modal manager that makes it easier to create dynamic, customizable, multi-language Bootstrap 4 based dialogs & modal windows with native options and event handlers.

How to use it:

1. Install & Download the bsModal library via package managers.

# Yarn
$ yarn add jquery-plugin-bsmodal

# NPM
$ npm install jquery-plugin-bsmodal --save

2. Load the main JavaScript file bsmodal.js into your Bootstrap 4 project.

<!-- Bootstrap 4-->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" crossorigin="anonymous"></script>

<!-- bsmodal plugin -->
<script src="/dist/bsmodal.js"></script>

3. Enable a trigger button to toggle a basic Bootstrap 4 modal.

<button type="button" class="btn btn-primary" id="exampleBtn">
  Launch demo modal
</button>
$('#exampleBtn').bsModal({
  id: 'bsModal',
  title: 'Modal Title',
  body: 'Modal Body'
});

4. Customize the appearance of the modal window.

$('#exampleBtn').bsModal({

  // modal ID
  id: 'exampleModal',

  // modal title
  title: 'Modal title',

  // 5 = <h5>
  titleLavel: 5,

  // body text
  body: '',

  // title ID
  label: null,

  // language
  lang: null,

  // modal selector
  modal: null,

  // enable/disable fade animation
  fade: true,

  // shows close button
  close: true,

  // shows background overlay
  backdrop: true,

  // uses confirm mode
  confirm: false,

  // text
  okBtnText: '',
  cancelBtnText: '',
  confirmOkText: '',
  confirmCancelText: '',
  langs: {},

  // theme
  okBtnColor: 'primary',
  cancelBtnColor: 'secondary'

});

5. Available event handlers.

$('#exampleBtn').bsModal({

  onOpen: function onOpen() {
    return true;
  },
  onClose: function onClose() {
    return true;
  },
  onOk: function onOk() {
    return true;
  },
  onCancel: function onCancel() {
    return true;
  }

});

Changelog:

2018-11-20

  • v1.0.4

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