Dynamic Bootstrap 4 Modal Manager - jQuery bsModal

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

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="/path/to/cdn/bootstrap.min.css" />
<script src="/path/to/cdn/jquery.slim.min.js"></script>
<script src="/path/to/cdn/bootstrap.min.js"></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:

v1.2.1 (2021-03-02)

  • Bugfix

v1.1.1 (2021-01-07)

  • Fix the onOpen, onOk, onCancel not working in bsModalCropper()

2020-11-20

  • Add uploadFile argument to onUpload & onCropper callback

2019-02-20

  • Fix confirm mode button text wrong

2018-12-25

  • v1.0.9

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