I have a single pager website where each of the buttons takes you to a separate section following an animation. I've set up an example here: https://dev.dport.me.
Currently when you navigate to a page, the URL stays the same. For example, navigating to the About section does not append #about
to the URL. I would like the site to work more like a normal site in respect to navigation.
What is the best way to go about making it such that:
- Navigating to a "page" changes the URL. Following the example, either to
#about
, or even better,/about
. - Navigating directly to a subpage works. Meaning that if I navigate to
https://dev.dport.me/about
, it takes me straight to the subpage. - The back button works. Currently if you navigate into a subpage, you must use the back button on the page. The browser's back button just leaves the whole site.
Is there some pre-existing javascript library that does what I'm looking for? Or am I going to have to gun it alone, perhaps with something like this.