0

My code is:

let stars = document.getElementsByClassName('stars');
        let moon = document.getElementsByClassName('moon');
        let mountains_behind = document.getElementsByClassName('mountains_behind');
        let text = document.getElementsByClassName('text');
        let btn = document.getElementsByClassName('btn');
        let mountains_front = document.getElementsByClassName('mountains_front');

        window.addEventListener('scroll', function(){
            let value = window.scrollY;
            stars.style.left = value * 0.25 + 'px';
        })

And I get the following error: Uncaught TypeError: Cannot set properties of undefined (setting 'left') How should I exactly define this property?

I tried to change the property or search how should I define one but didn't get the answer I really needed

0 Answers0