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
Adam Flanagan
8,022 PointsHow can I achieve this effect?
Basically I want to achieve a certain effect on my website when you scroll. For example look at this page: http://jelly.co/press . On the desktop version, when you scroll the nav bar gets smaller, how can I achieve a similar effect?
2 Answers
Geoff Parsons
11,679 PointsThe easiest way to achieve something like this would be to use javascript to trigger an event on page scroll. There are some useful libraries that could help you out here such as jQuery Waypoints.
James Barnett
39,199 PointsYou can't do that with CSS, it takes jQuery. Here's a working demo: http://jsfiddle.net/jezzipin/JJ8Jc/
James Barnett
39,199 PointsAnother option that looks pretty simple to implement as it just does the on scroll header is: https://github.com/weare2ndfloor/HeadShrinker
James Barnett
39,199 PointsJames Barnett
39,199 PointsjQuery Waypoints is pretty robust, the tradeoff of course is that it's not the simplest way to add the "on scroll header" effect.