Reputation: 101
I'm trying to create a one page website with jQuery. i'm trying to figure out how I change the URL of the website (E.g. www.test.be) when I click the right menu item. Right now it just gives (www.test.be/#) But I'd like it to say (www.test.be/work) for example. Also when I refresh I'd like the website to be on the page where the user was, not the first page. Would this be possible to achieve?
Upvotes: 0
Views: 189
Reputation: 9476
While you can do this with jQuery alone, it would be an uphill struggle. You're better off using a client-side MVC framework.
There are a number of client-side MVC frameworks available that should do this. I generally use Backbone.js, and using its routing you would easily be able to accomplish this kind of thing. It makes it very easy to define client-side routes with hashes and assign views to those routes. As long as you don't mind the URL being www.test.be/#work, that will be fine
You might also want to check out AngularJS as an alternative, but I can't speak for how easy it would be to implement this in Angular.
Upvotes: 1