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

jQuery Scroll Spy

I am trying to create a fixed nav that displays the section titles within a div with a set height (300px) and overflow-y: scroll. I have this fiddle that will work if a height is not specified. How can I make it work with a set height and overflow?

http://jsfiddle.net/rKvyn/

5 Answers

Just checked out the fiddle. What element are you trying to put a fixed height on?

I would like .wrapper to have a fixed height.

It looks like the issue is around you watching for events when the window scrolls, rather than when .wrapper scrolls. Check out out http://jsfiddle.net/rKvyn/. It's not perfect, but it's changing as the wrapper scrolls.

Derp, I meant to say check out http://jsfiddle.net/uAeVZ/. Sorry about that, Joe Bruno!

Looks good. I could have sworn I tried that fix! Thanks so much for you help with all my questions!