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

dylan kane
dylan kane
2,772 Points

Tumblr front page scrolling

https://www.tumblr.com/

how does the front page here scroll to fixed views like this? is there some code that I can use in my own site to duplicate this effect, or is something I would need to program myself with js?

1 Answer

LaVaughn Haynes
LaVaughn Haynes
12,397 Points

I believe that it's achieved with javaScript and CSS. You can track the scroll with javaScript and then either manipulate the page with JS or CSS based on the scroll.

Here is a simple example I put together which just changes the color of a div and prints the scroll position to the page.

https://jsbin.com/falani/edit?html,output

Look up some tutorials on parallax scrolling and that will walk you through what you need to know to do some interesting effects.

dylan kane
dylan kane
2,772 Points

dude, thank you so much for this awesome answer this is exactly what i needed. wish i could do more than just give you best answer!

LaVaughn Haynes
LaVaughn Haynes
12,397 Points

No problem. This is the series that I always recommend to people regarding parallax https://www.youtube.com/playlist?list=PLqGj3iMvMa4IyCbhul-PdeiDqmh4ooJzk

dylan kane
dylan kane
2,772 Points

once again, thanks you very much