trigger events when modal content is reloaded
This commit is contained in:
parent
9d2048094f
commit
690e117b0b
|
@ -3,8 +3,10 @@ const $ = require('jquery')
|
||||||
const openModal = function (url) {
|
const openModal = function (url) {
|
||||||
let container = $('#modal-container')
|
let container = $('#modal-container')
|
||||||
const body = $('body')
|
const body = $('body')
|
||||||
|
let doTrigger = true
|
||||||
|
|
||||||
if (!container.length) {
|
if (!container.length) {
|
||||||
|
let doTrigger = false
|
||||||
container = $('<div id="modal-container" class="modal">')
|
container = $('<div id="modal-container" class="modal">')
|
||||||
|
|
||||||
body.append(container)
|
body.append(container)
|
||||||
|
@ -20,6 +22,10 @@ const openModal = function (url) {
|
||||||
|
|
||||||
container.load(url, function () {
|
container.load(url, function () {
|
||||||
loader.remove()
|
loader.remove()
|
||||||
|
|
||||||
|
if (doTrigger) {
|
||||||
|
container.trigger('shown.bs.modal')
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue