How to add anchors to url based on which project in viewport

How can I add / change the #anchor in the url depending on to which project I scrolled?

So, when I scroll over the projects on my one-pager, I want the URL to change dynamically:

www.likethis.com#project-1
www.likethis.com#project-2
www.likethis.com#project-3

In the end, I want to be able to share URLs which link directly to projects on the page.

Everything I found so far is something like “data-url” or setting an article to “active”?