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

HTML

Nir Benita
PLUS
Nir Benita
Courses Plus Student 3,905 Points

Changing the URL of a single page website on scroll.

Hey guys!

So here's the deal, I'm working on a single page portfolio website.

I have 3 DIVs and I scroll to each one using a Hashtag (#).

I would like to have the URL change when I scroll down the page without having to actually push any buttons, instead, just by scrolling.

Any thoughts on this?

Also, I to learn how to change the class/ID of my menu when reaching a certain point on my page.

2 Answers

Check out jQuery Waypoints to execute functions as the page scrolls.

If you use history.js for the URL, in modern browsers you can change the directory of the URL without even requiring a hashtag.

Nir Benita
PLUS
Nir Benita
Courses Plus Student 3,905 Points

This is perfect! Will take me a while to wrap my head around it, but seems like a really great learning experience!