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


Paul Roberts
Paul Roberts
7,928 Points

jQuery: Change active class of nav when scroll down page.

I'm a bit out of my depth but I found the code to answer my original question:


However, my nav has a fixed height of 40px. I was wondering if it's possible to change the active class of the nav but to include the 40px height of my nav?

Sara Hardy
Sara Hardy
8,650 Points

Can you be more specific? I don't see a 40px high nav on the jsfiddle you provided. Are you trying to make the nav buttons the height of the parent container?

1 Answer

I am not 100% sure I understand what is being asked, but perhaps you are trying to add some css rules via jQuery? Perhaps the css() setter method? http://api.jquery.com/css/#css2