mirror of
https://github.com/Clortox/tylerperkins.xyz.git
synced 2026-03-07 10:37:58 +00:00
Claude tried
This commit is contained in:
@@ -2,10 +2,9 @@
|
|||||||
background-image: url("/img/webb-dark.png");
|
background-image: url("/img/webb-dark.png");
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 0;
|
top: 0;
|
||||||
bottom: 0;
|
|
||||||
left: 0;
|
left: 0;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 200%;
|
height: 100%;
|
||||||
overflow-y: hidden;
|
overflow-y: hidden;
|
||||||
z-index: -1;
|
z-index: -1;
|
||||||
|
|
||||||
|
|||||||
@@ -6,17 +6,23 @@ window.onload = function() {
|
|||||||
item.addEventListener("mouseover", scramble);
|
item.addEventListener("mouseover", scramble);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// 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";
|
||||||
|
|
||||||
|
// Add scroll listener for parallax effect
|
||||||
window.addEventListener('scroll', function() {
|
window.addEventListener('scroll', function() {
|
||||||
let parallax = document.querySelector('.parallax')
|
|
||||||
let scrollPosition = window.pageYOffset;
|
let scrollPosition = window.pageYOffset;
|
||||||
|
// Move background down slower than scroll (creates parallax depth)
|
||||||
|
parallax.style.transform = 'translateY(' + scrollPosition * 0.5 + 'px)';
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
let newSize = (document.querySelector('#content').offsetHeight * 0.8);
|
|
||||||
if(newSize < window.innerHeight)
|
|
||||||
newSize = window.innerHeight;
|
|
||||||
parallax.style.height = newSize + "px";
|
|
||||||
|
|
||||||
parallax.style.transform = 'translateY(' + scrollPosition * .5 + 'px)';
|
|
||||||
})
|
|
||||||
document.querySelectorAll(".typewriter").forEach(item => {
|
document.querySelectorAll(".typewriter").forEach(item => {
|
||||||
observer.observe(item);
|
observer.observe(item);
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user