From 1c93050a40f1a3350d8112d06e12711ab207cc7c Mon Sep 17 00:00:00 2001 From: juanatsap Date: Fri, 7 Nov 2025 22:13:16 +0000 Subject: [PATCH] fix: maintain scroll position when toggling logos - Save scroll position before toggling logos on/off - Restore scroll position after DOM updates using requestAnimationFrame - Prevents page jump when switching logo visibility --- templates/index.html | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/templates/index.html b/templates/index.html index cb3f864..796c00a 100644 --- a/templates/index.html +++ b/templates/index.html @@ -354,11 +354,19 @@ const toggle = document.getElementById('logoToggle'); const paper = document.querySelector('.cv-paper'); + // Save current scroll position + const currentScrollY = window.scrollY || window.pageYOffset; + if (toggle.checked) { paper.classList.add('show-logos'); } else { paper.classList.remove('show-logos'); } + + // Restore scroll position after DOM updates + requestAnimationFrame(() => { + window.scrollTo(0, currentScrollY); + }); } function toggleTheme() {