// Function to find all elements with class 'modal' and set up event listeners function setupModals() { var avadaModals = document.querySelectorAll('.modal'); avadaModals.forEach(function(avadaModal) { var iframeUrls = []; // Array to store unique iframe URLs for each avadaModal // Find all iframes within the avadaModal and extract their src URLs var iframes = avadaModal.querySelectorAll('iframe'); iframes.forEach(function(iframe) { iframeUrls.push(iframe.src); }); // Add event listener for when 'in' class is added to the avadaModal avadaModal.addEventListener('transitionend', function(event) { if (!event.target.classList.contains('in')) { // Add back the URLs to the iframes when 'in' class is added iframes.forEach(function(iframe, index) { iframe.src = iframeUrls[index]; }); } else { // Remove the src from iframes when 'in' class is removed iframes.forEach(function(iframe) { iframe.src = ''; }); } }); }); } // Call setupModals function when the document is loaded document.addEventListener('DOMContentLoaded', setupModals);

About admin

This author has not yet filled in any details.
So far admin has created 0 blog entries.
Go to Top