My website is experiencing a strange issue where the page seems to keep extending beyond the footer due to some JS code. I am not very familiar with JavaScript and have tried different solutions without success.
I have searched extensively online for a solution but have not found anything effective so far.
Below is the code snippet causing the problem:
const $ = document.querySelector.bind(document);
const w = $(".w");
const ee = $(".ee");
const l = $(".l");
const c = $(".c");
const o = $(".o");
const m = $(".m");
const e = $(".e");
function transformLetters() {
const scroll = window.scrollY;
w.style.transform = `translate3d(0, ${scroll*2.4}px, 0) rotateY(${-scroll*1.03}deg)`;
ee.style.transform = `translate3d(${-scroll*1.45}px, ${scroll*1.95}px, 0) rotate(${-scroll*1.1}deg)`;
l.style.transform = `translate3d(${scroll*1.65}px, ${-scroll*2.05}px, 0) rotate(${scroll*1.2}deg)`;
c.style.transform = `translate3d(0, ${scroll*2.75}px, 0) rotateY(${scroll*0.05}deg)`;
o.style.transform = `translate3d(${-scroll*1.75}px, ${scroll*1.65}px, 0) rotate(${-scroll*1.3}deg)`;
m.style.transform = `translate3d(0, ${-scroll*1.5}px, 0) rotateY(${scroll*1.05}deg)`;
e.style.transform = `translate3d(${-scroll*1.45}px, ${-scroll*1.95}px, 0) rotate(${-scroll*1.1}deg)`;
}
window.addEventListener("scroll", transformLetters);
.letters {
height: 100vh;
display: flex;
align-items: center;
justify-content: center;
color: hsl(0, 4%, 5%);
font-size: 3.5rem;
text-transform: uppercase;
-webkit-perspective: 1200px;
perspective: 1200px;
}
<div class="letters">
<span class="w">w</span>
<span class="ee">e</span>
<span class="l">l</span>
<span class="c">c</span>
<span class="o">o</span>
<span class="m">m</span>
<span class="e">e</span>
</div>