Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript

Whats wrong with parallax effect?

Hi,

Whats wrong with my parallax effect on the website ?

When I scroll down, the image goes up, but then when I scroll down, the image keeps going up. Maybe try using a framework or look up the code for parallax.

Thats the code for parallax, and I used the framework lol I'm asking for help

1 Answer

Hmm. The script doesn't seem to care if you're scrolling up or down, so it just keeps subtracting the new yPos value more and more, with the background moving faster the farther you get away from the top of the window. I know I'm kind of just restating the problem, but I'm trying to wrap my head around what's going wrong.

Where did you get the script from?

I don't remember. Iv looked on countless blogs.

If you're able to swap it out, Parallax.js is a classic, super reliable script. I'll keep working on this, though.