mirror of
https://github.com/kevinveenbirkenbach/homepage.veen.world.git
synced 2025-04-22 13:12:25 +02:00
Modified scrollbars for iframes
This commit is contained in:
parent
3529749df5
commit
6a0db00f24
@ -2,6 +2,7 @@ document.addEventListener("DOMContentLoaded", function () {
|
|||||||
const links = document.querySelectorAll(".iframe-link");
|
const links = document.querySelectorAll(".iframe-link");
|
||||||
const mainElement = document.querySelector("main");
|
const mainElement = document.querySelector("main");
|
||||||
const container = document.querySelector(".container");
|
const container = document.querySelector(".container");
|
||||||
|
const customScrollbar = document.getElementById("custom-scrollbar");
|
||||||
|
|
||||||
links.forEach(link => {
|
links.forEach(link => {
|
||||||
link.addEventListener("click", function (event) {
|
link.addEventListener("click", function (event) {
|
||||||
@ -19,6 +20,11 @@ document.addEventListener("DOMContentLoaded", function () {
|
|||||||
container.classList.replace("container", "container-fluid");
|
container.classList.replace("container", "container-fluid");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Hide the custom scrollbar
|
||||||
|
if (customScrollbar) {
|
||||||
|
customScrollbar.style.display = "none";
|
||||||
|
}
|
||||||
|
|
||||||
// Check if the iframe already exists
|
// Check if the iframe already exists
|
||||||
let iframe = mainElement.querySelector("iframe");
|
let iframe = mainElement.querySelector("iframe");
|
||||||
|
|
||||||
@ -28,6 +34,8 @@ document.addEventListener("DOMContentLoaded", function () {
|
|||||||
iframe.width = "100%";
|
iframe.width = "100%";
|
||||||
iframe.style.border = "none";
|
iframe.style.border = "none";
|
||||||
iframe.style.height = mainElement.style.height; // Apply fixed height
|
iframe.style.height = mainElement.style.height; // Apply fixed height
|
||||||
|
iframe.style.overflow = "auto"; // Enable scrollbar inside iframe
|
||||||
|
iframe.scrolling = "auto"; // Ensure scrollability
|
||||||
mainElement.innerHTML = ""; // Clear main content
|
mainElement.innerHTML = ""; // Clear main content
|
||||||
mainElement.appendChild(iframe);
|
mainElement.appendChild(iframe);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user