add loaded event for modal load

This commit is contained in:
diashalabi 2021-07-14 17:12:16 +03:00
parent 0c1fb51db0
commit 092d5ca13c

View File

@ -1,5 +1,8 @@
$('.remote').on('show.bs.modal', function (e) {
if (typeof e.relatedTarget !== "undefined") {
$(this).find('.modal-content').load(e.relatedTarget.href);
$(this).find('.modal-content').load(e.relatedTarget.href, function () {
const event = new Event('custom.modal.loaded');
$(this).closest('.modal').get(0).dispatchEvent(event);
});
}
});
});