-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
44 lines (38 loc) · 1.41 KB
/
script.js
File metadata and controls
44 lines (38 loc) · 1.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
const hamburger = document.getElementById("hamburger");
const navLinks = document.getElementById("navLinks");
hamburger.addEventListener("click", () => {
navLinks.classList.toggle("active");
});
document.addEventListener("DOMContentLoaded", function () {
// Toggle navigation menu for mobile
const navToggle = document.querySelector(".nav-toggle");
const navMenu = document.querySelector(".nav-menu");
if (navToggle && navMenu) {
navToggle.addEventListener("click", function () {
navMenu.classList.toggle("active");
});
}
// Ensure iframes (Google Drive previews) are responsive
const iframes = document.querySelectorAll("iframe");
iframes.forEach((iframe) => {
const wrapper = document.createElement("div");
wrapper.classList.add("responsive-iframe");
iframe.parentNode.insertBefore(wrapper, iframe);
wrapper.appendChild(iframe);
});
// Adjust text content or layout on small screens
function resizeTextContent() {
const sections = document.querySelectorAll(".section-text");
sections.forEach((section) => {
if (window.innerWidth < 768) {
section.style.fontSize = "1rem";
section.style.padding = "10px";
} else {
section.style.fontSize = "1.25rem";
section.style.padding = "20px";
}
});
}
window.addEventListener("resize", resizeTextContent);
resizeTextContent();
});