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
mattlebl
10,849 PointsAnyone know how to change the background as the user scrolls?
Hello, I was wondering how to create a static background that would, um... 'slice away' as the content scrolled...? Okay, that was terrible. To get a sense of what I mean check out the Lush Spa page, notice how the background changes as you scroll, and between sections you can see two backgrounds at once. I'm trying to recreate that, does anyone know how?
2 Answers
Guled A.
10,605 PointsI believe that there is some Javascript that must be incorporated into your project to obtain that effect. What you are looking for is called a vertical parallax effect. This effect would take some time to explain on the forums, but I assure you that I did some research in order to help you. I found what you were looking for online. Here is a tutorial I found, it also includes a demo. I hope this helped.
Neal Gist
8,438 PointsThis isn't the parallax effect you're asking for, but some simple code to change the background as the user scrolls... jic! :)
mattlebl
10,849 PointsNo, this isn't what I'm looking for, your example changes the background suddenly,