// Global variables to store elements and original state let mainElement, originalContent, originalMainStyle, container, customScrollbar, scrollbarContainer; let currentIframeUrl = null; // Synchronize the height of the iframe to match the scroll-container or main element function syncIframeHeight() { const iframe = mainElement.querySelector("iframe"); if (iframe) { if (scrollbarContainer) { // Prefer inline height, otherwise inline max-height const inlineHeight = scrollbarContainer.style.height; const inlineMax = scrollbarContainer.style.maxHeight; const target = inlineHeight || inlineMax; if (target) { iframe.style.height = target; } else { iframe.style.height = mainElement.style.height; } } else { iframe.style.height = mainElement.style.height; } } } // Function to open a URL in an iframe (jQuery version mit 1500 ms Fade) function openIframe(url) { enterFullscreen(); var $container = scrollbarContainer ? $(scrollbarContainer) : null; var $customScroll = customScrollbar ? $(customScrollbar) : null; var $main = $(mainElement); // Original-Content ausblenden mit 1500 ms var promises = []; if ($container) promises.push($container.fadeOut(1500).promise()); if ($customScroll) promises.push($customScroll.fadeOut(1500).promise()); $.when.apply($, promises).done(function() { // Iframe anlegen, falls noch nicht vorhanden var $iframe = $main.find('iframe'); if ($iframe.length === 0) { originalMainStyle = $main.attr('style') || null; $iframe = $('