Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

CSS

TzeYang Chew
TzeYang Chew
12,039 Points

how do i do this photo parallax effect from this webpage http://highergroundmelbourne.com.au/ below video section

hi, how do i do this photo parallax effect from this webpage http://highergroundmelbourne.com.au/ - below video section/ the photo at purple background

i can only do background attachment { fixed } but its not the same...

1 Answer

Steven Parker
Steven Parker
216,133 Points

You could analyze this with devtools to be sure, but just based on how it looks I'd guess that it's reasonably simple:

The image is probably inside a container element that is smaller than the image, with overflow set to hidden. Then a JavaScript routine is triggered by scroll events that makes slight changes to the image position based on the scroll position.

That page has several nice effects, my favorite was the "flashlight" effect where the sharp circle follows the mouse around an otherwise hazy photo.