I'm facing an issue with the script tag in index.html not functioning properly. I can't figure out why it's not working despite trying to add it into another file and providing a link.
let stars = document.getElementById('stars')
let moon = document.getElementById('moon')
let mountain_behind = document.getElementById('mountain-behind')
let mountain_front = document.getElementById('mountain-front')
let btn = document.getElementById('btn')
let text = document.getElementById('text')
//let header = document.querySelector('header')
window.addEventListener("scroll", function() {
let value = window.screenY;
stars.style.left = value * 0.25 + 'px'
moon.style.top = value * 1.05 + 'px'
mountain_behind.style.top = value * 0.5 + 'px'
mountain_front.style.top = value * 0 + 'px'
text.style.marginRight = value * 4 + 'px'
text.style.marginTop = value * 1.5 + 'px'
btn.style.marginTop = value * 1.5 + 'px'
//header.style.top = value * 0.5 + "px"
})
body, html { height: 1000px; }
<section>
<img src="img/stars.png" id="stars">
<img src="img/moon.png" id="moon">
<img src="img/mountains_behind.png" id="mountain-behind">
<h2 id="text">Genesis 2k22</h2>
<a href="#sec" id="btn" class="btn">Register Now</a>
<img src="img/mountains_front.png" id="mountain-front">
</section>