From ee7899bb89331f0ce44f6984d150b762ee792fcb Mon Sep 17 00:00:00 2001 From: Tyler Perkins Date: Fri, 16 Jan 2026 22:05:27 -0500 Subject: [PATCH] Claude tried --- static/css/background.css | 3 +-- themes/clortox/static/js/script.js | 24 +++++++++++++++--------- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/static/css/background.css b/static/css/background.css index 20a37d8..76fc759 100644 --- a/static/css/background.css +++ b/static/css/background.css @@ -2,10 +2,9 @@ background-image: url("/img/webb-dark.png"); position: absolute; top: 0; - bottom: 0; left: 0; width: 100%; - height: 200%; + height: 100%; overflow-y: hidden; z-index: -1; diff --git a/themes/clortox/static/js/script.js b/themes/clortox/static/js/script.js index 616a6e0..062cedd 100644 --- a/themes/clortox/static/js/script.js +++ b/themes/clortox/static/js/script.js @@ -6,17 +6,23 @@ window.onload = function() { item.addEventListener("mouseover", scramble); }); - window.addEventListener('scroll', function() { - let parallax = document.querySelector('.parallax') - let scrollPosition = window.pageYOffset; + // Set parallax height once on load + let parallax = document.querySelector('.parallax'); + if (parallax) { + let content = document.querySelector('#content'); + // Set height to content height but don't go below viewport height + let contentHeight = content.scrollHeight; + let parallaxHeight = Math.max(contentHeight, window.innerHeight); + parallax.style.height = parallaxHeight + "px"; - let newSize = (document.querySelector('#content').offsetHeight * 0.8); - if(newSize < window.innerHeight) - newSize = window.innerHeight; - parallax.style.height = newSize + "px"; + // Add scroll listener for parallax effect + window.addEventListener('scroll', function() { + let scrollPosition = window.pageYOffset; + // Move background down slower than scroll (creates parallax depth) + parallax.style.transform = 'translateY(' + scrollPosition * 0.5 + 'px)'; + }); + } - parallax.style.transform = 'translateY(' + scrollPosition * .5 + 'px)'; - }) document.querySelectorAll(".typewriter").forEach(item => { observer.observe(item); });