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

One page site. Link becomes active when at a specific anchor

Hi Everyone,

I'm building a one page site, and as you can see I'm a little confused about how to word what I'm looking for. I was wondering if anyone could help me.

The website will be a 1 page, smooth scrolling responsive site, with anchor tags to go to a specific place on the page. I will have a fixed header at the top of the page. I've done all these things before but what I want to do now is have the link on the fixed header highlight, when on that specific section.

For example: I've clicked the 'about' button in the fixed nav. It's smooth scrolled down to the about section (div). How do I make it so the about button is a different color in the fixed nav. And then when I scroll out of the about section and into a different div, it'll change back to the original, and then the next button eg. Contact will become highlighted. To see more clearly what I'm trying to explain please visit: http://www.theorydesign.ca/

Am I right in assuming this would be a javascript thing, or is it possible to do it in css? If anyone could point me in the right direction I'd be extremely grateful.

Thanks,

Nick

Try using twitter bootstrap nick. It has a very easy to use way of achieving what you're looking for.

3 Answers

Twitter Bootstrap is way overkill for that when a simple JQuery plugin will work.

http://chriswojcik.net/demos/single-page-nav/

I agree with Vijay Rangan. Twitter bootstrap sounds like it has everything you need for functionality. Check this out

http://getbootstrap.com/javascript/#scrollspy

that looks good. thanks fellas.