25 lines
546 B
JavaScript
25 lines
546 B
JavaScript
const $ = require('jquery');
|
|
|
|
module.exports = function() {
|
|
$('*[data-modal]').click((e) => {
|
|
e.preventDefault();
|
|
e.stopPropagation();
|
|
|
|
let container = $('#modal-container');
|
|
|
|
if (!container.length) {
|
|
container = $('<div id="modal-container" class="modal">');
|
|
|
|
$('body').append(container);
|
|
}
|
|
|
|
container.html('');
|
|
|
|
const url = $(e.target).attr('data-modal');
|
|
|
|
container.load(url, function() {
|
|
$(container).modal('show');
|
|
});
|
|
});
|
|
}
|