mirror of
https://github.com/kevinveenbirkenbach/homepage.veen.world.git
synced 2025-07-19 15:44:24 +02:00
Solved 2tap fullscreen hight bug
This commit is contained in:
parent
ab8ea0dbd6
commit
6ed3e60dd0
@ -1,5 +1,6 @@
|
|||||||
// Global variables to store elements and original state
|
// Global variables to store elements and original state
|
||||||
let mainElement, originalContent, originalMainStyle, container, customScrollbar, scrollbarContainer;
|
let mainElement, originalContent, originalMainStyle, container, customScrollbar, scrollbarContainer;
|
||||||
|
let currentIframeUrl = null;
|
||||||
|
|
||||||
// Synchronize the height of the iframe to match the scroll-container or main element
|
// Synchronize the height of the iframe to match the scroll-container or main element
|
||||||
function syncIframeHeight() {
|
function syncIframeHeight() {
|
||||||
@ -103,41 +104,21 @@ document.addEventListener("DOMContentLoaded", function() {
|
|||||||
customScrollbar = document.getElementById("custom-scrollbar");
|
customScrollbar = document.getElementById("custom-scrollbar");
|
||||||
scrollbarContainer = container.querySelector(".scroll-container")
|
scrollbarContainer = container.querySelector(".scroll-container")
|
||||||
|
|
||||||
// Attach click handlers to links that should open in an iframe
|
|
||||||
document.querySelectorAll(".iframe-link").forEach(link => {
|
|
||||||
link.addEventListener("click", function(event) {
|
|
||||||
event.preventDefault(); // prevent full page navigation
|
|
||||||
openIframe(this.href);
|
|
||||||
updateUrlFullWidth(true);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
document.querySelectorAll(".js-restore").forEach(el => {
|
document.querySelectorAll(".js-restore").forEach(el => {
|
||||||
el.style.cursor = "pointer";
|
el.style.cursor = "pointer";
|
||||||
el.addEventListener("click", restoreOriginal);
|
el.addEventListener("click", restoreOriginal);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// === Close iframe & exit fullscreen on any .js-restore click ===
|
||||||
// On full page load, check URL parameters to auto-open an iframe
|
document.body.addEventListener('click', e => {
|
||||||
window.addEventListener("load", function() {
|
if (e.target.closest('.js-restore')) {
|
||||||
const params = new URLSearchParams(window.location.search);
|
|
||||||
const iframeUrl = params.get('iframe');
|
|
||||||
if (iframeUrl) {
|
|
||||||
openIframe(iframeUrl);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
// Handle browser back/forward navigation
|
|
||||||
window.addEventListener('popstate', function(event) {
|
|
||||||
const params = new URLSearchParams(window.location.search);
|
|
||||||
const iframeUrl = params.get('iframe');
|
|
||||||
|
|
||||||
if (iframeUrl) {
|
|
||||||
openIframe(iframeUrl);
|
|
||||||
} else {
|
|
||||||
restoreOriginal();
|
restoreOriginal();
|
||||||
|
exitFullscreen();
|
||||||
|
currentIframeUrl = null;
|
||||||
|
history.replaceState(null, '', window.location.pathname);
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -181,3 +162,13 @@ function observeIframeNavigation() {
|
|||||||
}
|
}
|
||||||
}, 500);
|
}, 500);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Remember and open via central toggle
|
||||||
|
document.querySelectorAll(".iframe-link").forEach(link => {
|
||||||
|
link.addEventListener("click", function(event) {
|
||||||
|
event.preventDefault();
|
||||||
|
currentIframeUrl = this.href;
|
||||||
|
enterFullscreen();
|
||||||
|
openIframe(currentIframeUrl);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user