From efe469d4f528f1a9eb14095cc251ddfc65b9a1d9 Mon Sep 17 00:00:00 2001 From: Corban-Lee Jones Date: Thu, 24 Oct 2024 18:19:57 +0100 Subject: [PATCH] allow transition between 2 custom modal uses --- apps/home/static/home/js/modals.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/apps/home/static/home/js/modals.js b/apps/home/static/home/js/modals.js index 2d6d476..e52023f 100644 --- a/apps/home/static/home/js/modals.js +++ b/apps/home/static/home/js/modals.js @@ -22,6 +22,12 @@ const arrayToHtmlList = (array, bold=false) => { const createModal = async (options = {}) => { let $modal = $("#customModal"); + // If transitioning from one modal to another, wait for this one to close + if ($modal.is(':visible')) { + $modal.modal('hide'); + await new Promise(resolve => $modal.one('hidden.bs.modal', resolve)); + } + let defaults = { title: "Modal Title", texts: [