music: resize wall of text on size changed

This commit is contained in:
Agahnim 2026-05-13 14:24:54 +02:00
parent 5263b4af90
commit 351a133914

View file

@ -7,13 +7,15 @@
<script>
(function () {
const chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
const container = document.getElementById("bg-text");
if (!container) return;
const colWidth = 20;
const rowHeight = 24;
const container = document.getElementById("bg-text");
if (!container) return;
function build() {
container.innerHTML = "";
const cols = Math.ceil(window.innerWidth / colWidth);
const rows = Math.ceil(window.innerHeight / rowHeight);
for (let c = 0; c < cols; c++) {
const col = document.createElement("vertical-marquee-inner");
col.style.left = c * colWidth + "px";
@ -24,5 +26,14 @@
}
container.appendChild(col);
}
}
let resizeTimer;
window.addEventListener("resize", function () {
clearTimeout(resizeTimer);
resizeTimer = setTimeout(build, 150);
});
build();
})();
</script>