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

Translate on scroll in jquery

I need help regarding the translate-animate property. There's an img I want to translate in the upward direction when I scroll down on the page. Now i know you can the property translateY(px) to move it but then I dont know how to translateY while scrolling. I want to make my webpage look like this

https://www.apple.com/uk/iphone/

As you can see when you scroll down the image translate upwards with a smooth flow. I need the code so that I can translate my img upward smoothly on scrolling down.

1 Answer

waypoints could possibly help you. It can execute JavaScript when you scroll to a specific element. https://github.com/imakewebthings/waypoints