diff --git a/index.js b/index.js index fec8292..7d9639c 100644 --- a/index.js +++ b/index.js @@ -704,7 +704,18 @@ } }; + + /** + * If modals are being added to the DOM dynamically, redefine the modal variable + * and initialize again. + */ + ARIAmodal.refresh = function () { + modal = doc.querySelectorAll('[data-modal]'); + children = doc.querySelectorAll('body > *:not([data-modal])'); + ARIAmodal.init(); + }; + /** * Initialize modal functions. * If expanding this script, put